summaryrefslogtreecommitdiff
path: root/support/tcltexed/lib/RCS/umlaut.tcl,v
blob: 564d2f64143f15658dd6089c59db2fee584f2e03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
head	1.3;
access;
symbols;
locks
	mys:1.3; strict;
comment	@# @;


1.3
date	2000.08.15.22.34.13;	author mys;	state Exp;
branches;
next	1.2;

1.2
date	2000.04.11.21.41.24;	author mys;	state Exp;
branches;
next	1.1;

1.1
date	2000.04.11.19.09.28;	author mys;	state Exp;
branches;
next	;


desc
@@


1.3
log
@*** empty log message ***
@
text
@# Copyright (C) 2000 - Martin Strauss - under terms of GPL
##############################################################
# umlaut routine
# 
proc umlaut LIST {
 global FocusEditorFlag
 global FocusEditor
 if $FocusEditorFlag then {
  focus $FocusEditor.te.edit1
  foreach {FIND REPLACE} $LIST {
    set FIND_L [string length "$FIND"]
    if {$FIND != ""} then { 
     set modifiedflag 0
     undo_switch $FocusEditor.te.edit1 Save
     set startindex [$FocusEditor.te.edit1 index insert]
     set nowindex 1.0
     while {$nowindex != ""} {
      $FocusEditor.te.edit1 mark set insert $nowindex
      set NOW [$FocusEditor.te.edit1 get insert "insert + $FIND_L chars"]
      if ![string compare $NOW $FIND] then {
       # Ersetzt
       $FocusEditor.te.edit1 delete insert "insert + $FIND_L chars"
       $FocusEditor.te.edit1 insert insert $REPLACE
       set modifiedflag 1
      }
      # Sucht
      set nowindex [$FocusEditor.te.edit1 search -- $FIND insert end]
     }
     $FocusEditor.te.edit1 mark set insert $startindex
     if $modifiedflag {
      event generate $FocusEditor.te.edit1 <<Modified>>
     }
     event generate $FocusEditor.te.edit1 <<Position_tail>> -when tail
    }
   }
 }
}
@


1.2
log
@*** empty log message ***
@
text
@d22 1
@


1.1
log
@Initial revision
@
text
@d1 36
a36 40
# Copyright (C) 1999 - Martin Strauss - under terms of GPL
##############################################################
# umlaut routine
# 
proc umlaut LIST {
 global T
 global FocusEditorFlag
 global FocusEditor
 if $FocusEditorFlag then {
  focus $FocusEditor.te.edit1
  foreach {FIND REPLACE} $LIST {
    set FIND_L [string length "$FIND"]
    if {$FIND != ""} then { 
     set modifiedflag 0
     undo_switch $FocusEditor.te.edit1 Save
     set startindex [$FocusEditor.te.edit1 index insert]
     set nowindex 1.0
     while {$nowindex != ""} {
      $FocusEditor.te.edit1 mark set insert $nowindex
      set NOW [$FocusEditor.te.edit1 get insert "insert + $FIND_L chars"]
      if ![string compare $NOW $FIND] then {
       # Ersetzt
       undo_switch $FocusEditor.te.edit1 "{insert \"insert + $FIND_L chars\"} Delete UndoBegin"
       $FocusEditor.te.edit1 insert insert $REPLACE
       undo_switch $FocusEditor.te.edit1 UndoEnd
       set modifiedflag 1
      }
      # Sucht
      set nowindex [$FocusEditor.te.edit1 search -- $FIND insert end]
     }
     $FocusEditor.te.edit1 mark set insert $startindex
     if $modifiedflag {
      undo_switch $FocusEditor.te.edit1 Save
      event generate $FocusEditor.te.edit1 <<Modified>>
     }
     event generate $FocusEditor.te.edit1 <<Position_tail>> -when tail
    }
   }
 }
}
@