Tk Text Edit

Check-in [8155d67dc7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed several bugs in findreplace routines
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8155d67dc78524388dce5e70082a8a67d315b0ad
User & Date: dennis 2000-06-17 00:57:46
Context
2000-06-17
02:13
Added some new colour coding to the flist check-in: 96cb216518 user: dennis tags: trunk
00:57
Fixed several bugs in findreplace routines check-in: 8155d67dc7 user: dennis tags: trunk
2000-04-29
21:04
Added bug report from Iuri Wickert check-in: 8cc6445fde user: dennis tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/BUGS.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 Add possibility to erase macros
 Add Config wizard
 Add more sample macros
 Add menu entry for the flist, and remove it from the windows menu
     also remove the old bindings for files in the windows menu in window.tcl.
 
Bugs:
 "Replace All" option on the replace dialog box. It complains
 about a not reading a variable called 'rconfirm'. Beside that, I like
 using TTE very much.
 (Iuri Wickert)

 If a file exists in both installdir and home then it's listed twice in the menu.

Continuing work:
 Update all commands so that they work with macros.
 Write help text







<
<
<
<
<
|




2
3
4
5
6
7
8





9
10
11
12
13
 Add possibility to erase macros
 Add Config wizard
 Add more sample macros
 Add menu entry for the flist, and remove it from the windows menu
     also remove the old bindings for files in the windows menu in window.tcl.
 
Bugs:





 If a macro file exists in both installdir and home then it's listed twice in the menu.

Continuing work:
 Update all commands so that they work with macros.
 Write help text

Changes to lib/edit.tcl.

1
2
3
4
5
6
7
8
set debug_messages 0 
set tcl_traceExec 0

set prgname "Tcl TextEdit 0.9.9"

#?-About
#?%2TCL TextEdit v0.9.x%
#?
|







1
2
3
4
5
6
7
8
set debug_messages 1 
set tcl_traceExec 0

set prgname "Tcl TextEdit 0.9.9"

#?-About
#?%2TCL TextEdit v0.9.x%
#?

Changes to lib/findreplace.tcl.

215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
...
265
266
267
268
269
270
271
272


273
274
275
276
277
278
279
...
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
catch {destroy $q}
toplevel $q
wm title $q "Replace ?"
label $q.label -text "Replace this occurance ?"
frame $q.buttons
button $q.buttons.yes -text "Yes" -command "set r 1" 
button $q.buttons.no  -text "No" -command  "set r 0"

pack $q.buttons.yes $q.buttons.no -side left
pack $q.label $q.buttons
powin $q
grab $q
vwait r
destroy $q
return $r
}



proc ReplaceIt {n} {
global SearchString SearchDir ReplaceString findcase window current_window rconfirm

set SearchPos insert
c 
set window($current_window,echange) 1
set window($current_window,change) 1

if {$n!="norec"} {
................................................................................
set SearchPos [ .text search $caset -$SearchDir $SearchString $SearchPos $limit]

if {$SearchPos != ""} {
        .text see $SearchPos

	if {$rconfirm==1} { 
 		             .text tag add sel $SearchPos  "$SearchPos+$leng char"
                                             if {[question]==1} {


				           .text delete $SearchPos "$SearchPos+$leng char"
				           .text insert $SearchPos $ReplaceString
				            }
		             .text tag remove sel $SearchPos
		              } else {
			          .text delete $SearchPos "$SearchPos+$leng char"
             		                          .text insert $SearchPos $ReplaceString
................................................................................

	} else {
	           set SearchPos "0.0"
	           }
}

proc ReplaceAll {} {
global SearchString SearchDir ReplaceString findcase window current_window

macro::rec global SearchString SearchDir findcase ReplaceString rconfirm
macro::rec set ReplaceString $ReplaceString
macro::rec set SearchString $SearchString
macro::rec set SearchDir    $SearchDir
macro::rec set findcase     $findcase
macro::rec set rconfirm     $rconfirm
macro::rec ReplaceAll

set window($current_window,echange) 1
set window($current_window,change) 1

c
ReplaceIt norec
while {$SearchPos!="0.0"} {
ReplaceIt norec
}
}

proc CancelFind {w} {
.text tag delete tg1
destroy $w
}







>
|











|







 







|
>
>







 







|













|

|







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
catch {destroy $q}
toplevel $q
wm title $q "Replace ?"
label $q.label -text "Replace this occurance ?"
frame $q.buttons
button $q.buttons.yes -text "Yes" -command "set r 1" 
button $q.buttons.no  -text "No" -command  "set r 0"
button $q.buttons.abort  -text "Abort" -command  "set r 2"
pack $q.buttons.yes $q.buttons.no $q.buttons.abort -side left
pack $q.label $q.buttons
powin $q
grab $q
vwait r
destroy $q
return $r
}



proc ReplaceIt {n} {
global SearchString SearchDir ReplaceString findcase window current_window rconfirm SearchPos

set SearchPos insert
c 
set window($current_window,echange) 1
set window($current_window,change) 1

if {$n!="norec"} {
................................................................................
set SearchPos [ .text search $caset -$SearchDir $SearchString $SearchPos $limit]

if {$SearchPos != ""} {
        .text see $SearchPos

	if {$rconfirm==1} { 
 		             .text tag add sel $SearchPos  "$SearchPos+$leng char"
					    set qq [question]
					    if {$qq==2} {return quit}
                                             if {$qq==1} {
				           .text delete $SearchPos "$SearchPos+$leng char"
				           .text insert $SearchPos $ReplaceString
				            }
		             .text tag remove sel $SearchPos
		              } else {
			          .text delete $SearchPos "$SearchPos+$leng char"
             		                          .text insert $SearchPos $ReplaceString
................................................................................

	} else {
	           set SearchPos "0.0"
	           }
}

proc ReplaceAll {} {
global SearchString SearchDir ReplaceString findcase window current_window rconfirm SearchPos

macro::rec global SearchString SearchDir findcase ReplaceString rconfirm
macro::rec set ReplaceString $ReplaceString
macro::rec set SearchString $SearchString
macro::rec set SearchDir    $SearchDir
macro::rec set findcase     $findcase
macro::rec set rconfirm     $rconfirm
macro::rec ReplaceAll

set window($current_window,echange) 1
set window($current_window,change) 1

c
if {[ReplaceIt norec]=="quit"} return
while {$SearchPos!="0.0"} {
if {[ReplaceIt norec]=="quit"} return
}
}

proc CancelFind {w} {
.text tag delete tg1
destroy $w
}