arcadia 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/README +25 -14
  2. data/conf/LC/en-UK.LANG +3 -1
  3. data/conf/arcadia.conf +10 -0
  4. data/conf/arcadia.res.rb +29 -1
  5. data/ext/ae-editor/ae-editor.rb +239 -48
  6. data/ext/ae-file-history/ae-file-history.conf +11 -1
  7. data/ext/ae-file-history/ae-file-history.rb +120 -2
  8. data/ext/ae-ruby-debug/ae-ruby-debug.rb +6 -5
  9. data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +7 -3
  10. data/ext/ae-term/ae-term.rb +1 -1
  11. data/lib/a-commons.rb +72 -56
  12. data/lib/a-contracts.rb +23 -1
  13. data/lib/a-core.rb +136 -41
  14. data/lib/a-tkcommons.rb +127 -36
  15. data/tcl/fsdialog/fsdialog.tcl +2 -2
  16. data/tcl/ptwidgets-1.1.0/COPYRIGHT +10 -0
  17. data/tcl/ptwidgets-1.1.0/ChangeLog +194 -0
  18. data/tcl/ptwidgets-1.1.0/README +50 -0
  19. data/tcl/ptwidgets-1.1.0/common/stacktrace.tcl +29 -0
  20. data/tcl/ptwidgets-1.1.0/common/tokenframe.tcl +200 -0
  21. data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_off.png +0 -0
  22. data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_on.png +0 -0
  23. data/tcl/ptwidgets-1.1.0/doc/img/tokenentry.png +0 -0
  24. data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example.png +0 -0
  25. data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example2.png +0 -0
  26. data/tcl/ptwidgets-1.1.0/doc/img/wmarkentry.png +0 -0
  27. data/tcl/ptwidgets-1.1.0/doc/toggleswitch.html +402 -0
  28. data/tcl/ptwidgets-1.1.0/doc/tokenentry.html +1366 -0
  29. data/tcl/ptwidgets-1.1.0/doc/tokensearch.html +1549 -0
  30. data/tcl/ptwidgets-1.1.0/doc/wmarkentry.html +634 -0
  31. data/tcl/ptwidgets-1.1.0/library/toggleswitch.tcl +432 -0
  32. data/tcl/ptwidgets-1.1.0/library/tokenentry.tcl +2208 -0
  33. data/tcl/ptwidgets-1.1.0/library/tokensearch.tcl +2488 -0
  34. data/tcl/ptwidgets-1.1.0/library/wmarkentry.tcl +630 -0
  35. data/tcl/ptwidgets-1.1.0/pkgIndex.tcl +10 -0
  36. data/tcl/ptwidgets-1.1.0/test/Makefile +3 -0
  37. data/tcl/ptwidgets-1.1.0/test/run.tcl +3 -0
  38. data/tcl/ptwidgets-1.1.0/test/test.tcl +89 -0
  39. data/tcl/ptwidgets-1.1.0/test/toggleswitch.test +562 -0
  40. data/tcl/ptwidgets-1.1.0/test/tokenentry.test +1023 -0
  41. data/tcl/ptwidgets-1.1.0/test/tokensearch.test +1023 -0
  42. data/tcl/ptwidgets-1.1.0/test/wmarkentry.test +1325 -0
  43. data/tcl/themes/altTheme.tcl +101 -0
  44. data/tcl/themes/aquaTheme.tcl +59 -0
  45. data/tcl/themes/clamTheme.tcl +140 -0
  46. data/tcl/themes/classicTheme.tcl +108 -0
  47. data/tcl/themes/pkgIndex.tcl +3 -0
  48. data/tcl/themes/ttk.tcl +176 -0
  49. data/tcl/themes/vistaTheme.tcl +224 -0
  50. data/tcl/themes/winTheme.tcl +80 -0
  51. data/tcl/themes/xpTheme.tcl +65 -0
  52. data/tcl/tkfbox/folder.gif +0 -0
  53. data/tcl/tkfbox/textfile.gif +0 -0
  54. data/tcl/tkfbox/tkfbox.tcl +1 -0
  55. data/tcl/tkfbox/tkfbox.tcl~ +1 -0
  56. data/tcl/tkfbox/updir.xbm +1 -0
  57. metadata +43 -2
@@ -0,0 +1,630 @@
1
+ #===============================================================
2
+ # Main wmarkentry package module
3
+ #
4
+ # Copyright (c) 2011-2012 Trevor Williams (phase1geo@gmail.com)
5
+ #===============================================================
6
+
7
+ package provide wmarkentry 1.0
8
+
9
+ namespace eval wmarkentry {
10
+
11
+ array set options {}
12
+ array set state {}
13
+ array set textvar {}
14
+
15
+ array set entry_options {
16
+ -background 1
17
+ -bg 1
18
+ -borderwidth 1
19
+ -bd 1
20
+ -cursor 1
21
+ -disabledbackground 1
22
+ -disabledforeground 1
23
+ -exportselection 1
24
+ -font 1
25
+ -highlightbackground 1
26
+ -highlightcolor 1
27
+ -highlightthickness 1
28
+ -insertbackground 1
29
+ -insertborderwidth 1
30
+ -insertofftime 1
31
+ -insertontime 1
32
+ -insertwidth 1
33
+ -invalidcommand 1
34
+ -invcmd 1
35
+ -justify 1
36
+ -readonlybackground 1
37
+ -relief 1
38
+ -selectbackground 1
39
+ -selectborderwidth 1
40
+ -selectforeground 1
41
+ -show 1
42
+ -state 1
43
+ -takefocus 1
44
+ -validate 1
45
+ -validatecommand 1
46
+ -vcmd 1
47
+ -width 1
48
+ -xscrollcommand 1
49
+ }
50
+
51
+ array set widget_options {
52
+ -background {background Background}
53
+ -bg -background
54
+ -borderwidth {borderWidth BorderWidth}
55
+ -bd -borderwidth
56
+ -cursor {cursor Cursor}
57
+ -disabledbackground {disabledBackground DisabledBackground}
58
+ -disabledforeground {disabledForeground DisabledForeground}
59
+ -exportselection {exportSelection ExportSelection}
60
+ -font {font Font}
61
+ -foreground {foreground Foreground}
62
+ -fg -foreground
63
+ -highlightbackground {highlightBackground HighlightBackground}
64
+ -highlightcolor {highlightColor HighlightColor}
65
+ -highlightthickness {highlightThickness HighlightThickness}
66
+ -insertbackground {insertBackground InsertBackground}
67
+ -insertborderwidth {insertBorderWidth InsertBorderWidth}
68
+ -insertofftime {insertOffTime InsertOffTime}
69
+ -insertontime {insertOnTime InsertOnTime}
70
+ -insertwidth {insertWidth InsertWidth}
71
+ -invalidcommand {invalidCommand InvalidCommand}
72
+ -invcmd -invalidcommand
73
+ -justify {justify Justify}
74
+ -readonlybackground {readonlyBackground ReadonlyBackground}
75
+ -relief {relief Relief}
76
+ -selectbackground {selectBackground Background}
77
+ -selectborderwidth {selectBorderWidth BorderWidth}
78
+ -selectforeground {selectForeground Foreground}
79
+ -show {show Show}
80
+ -state {state State}
81
+ -takefocus {takeFocus TakeFocus}
82
+ -textvariable {textVariable Variable}
83
+ -validate {validate Validate}
84
+ -validatecommand {validateCommand ValidateCommand}
85
+ -vcmd -validatecommand
86
+ -watermark {watermark Watermark}
87
+ -watermarkforeground {watermarkForeground Foreground}
88
+ -width {width Width}
89
+ -xscrollcommand {xScrollCommand ScrollCommand}
90
+ }
91
+
92
+ ###########################################################################
93
+ # Main procedure which creates the given window and initializes it.
94
+ proc wmarkentry {w args} {
95
+
96
+ variable options
97
+ variable widget_options
98
+ variable state
99
+
100
+ # Create the frame
101
+ frame $w -class WMarkEntry -relief flat -takefocus 0
102
+
103
+ # Initially, we pack the frame with a text widget
104
+ entry $w.e -highlightthickness 0 -relief flat -bg white -takefocus 1
105
+
106
+ # Pack the text widget
107
+ pack $w.e -side left -fill both -expand yes
108
+
109
+ # Initialize default options
110
+ if {[array size options] == 0} {
111
+ foreach opt [array names widget_options] {
112
+ if {![catch "$w.e configure $opt" rc]} {
113
+ if {[llength $widget_options($opt)] != 1} {
114
+ if {$opt eq "-background"} {
115
+ set default_value "white"
116
+ } elseif {$opt eq "-relief"} {
117
+ set default_value "flat"
118
+ } else {
119
+ set default_value [lindex $rc 4]
120
+ }
121
+ option add *WMarkEntry.[lindex $rc 1] $default_value
122
+ }
123
+ }
124
+ }
125
+ option add *WMarkEntry.watermark ""
126
+ option add *WMarkEntry.watermarkForeground "light gray"
127
+ }
128
+
129
+ # Initialize variables
130
+ set state($w) "empty"
131
+
132
+ # Initialize the options array
133
+ foreach opt [array names widget_options] {
134
+ if {[llength $widget_options($opt)] != 1} {
135
+ set options($w,$opt) [option get $w [lindex $widget_options($opt) 0] [lindex $widget_options($opt) 1]]
136
+ }
137
+ }
138
+
139
+ # Setup bindings
140
+ bind $w.e <Left> {
141
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
142
+ break
143
+ }
144
+ }
145
+ bind $w.e <Right> {
146
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
147
+ break
148
+ }
149
+ }
150
+ bind $w.e <Down> {
151
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
152
+ break
153
+ }
154
+ }
155
+ bind $w.e <Up> {
156
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
157
+ break
158
+ }
159
+ }
160
+ bind $w.e <Button-1> {
161
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
162
+ %W icursor 0
163
+ focus %W
164
+ break
165
+ }
166
+ }
167
+ bind $w.e <B1-Motion> {
168
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
169
+ break
170
+ }
171
+ }
172
+ bind $w.e <B1-Leave> {
173
+ if {[wmarkentry::handle_text_movement [winfo parent %W]]} {
174
+ break
175
+ }
176
+ }
177
+ bind $w.e <Control-k> {
178
+ if {$wmarkentry::state([winfo parent %W]) eq "empty"} {
179
+ break
180
+ } else {
181
+ wmarkentry::handle_state [winfo parent %W] 0
182
+ }
183
+ }
184
+ bind $w.e <Control-a> {
185
+ if {$wmarkentry::state([winfo parent %W]) eq "empty"} {
186
+ break
187
+ }
188
+ }
189
+ bind $w.e <Control-A> {
190
+ if {$wmarkentry::state([winfo parent %W]) eq "empty"} {
191
+ break
192
+ }
193
+ }
194
+ bind $w.e <End> {
195
+ if {$wmarkentry::state([winfo parent %W]) eq "empty"} {
196
+ break
197
+ }
198
+ }
199
+ bind $w.e <Control-e> {
200
+ if {$wmarkentry::state([winfo parent %W]) eq "empty"} {
201
+ break
202
+ }
203
+ }
204
+ bind $w.e <Control-E> {
205
+ if {$wmarkentry::state([winfo parent %W]) eq "empty"} {
206
+ break
207
+ }
208
+ }
209
+ bind $w.e <Any-KeyPress> "wmarkentry::keypress $w %A"
210
+
211
+ # Configure the widget
212
+ eval "configure 1 $w $args"
213
+
214
+ # Rename and alias the wmarkentry window
215
+ rename ::$w $w
216
+ interp alias {} ::$w {} wmarkentry::widget_cmd $w
217
+
218
+ return $w
219
+
220
+ }
221
+
222
+ ###########################################################################
223
+ # This procedure is called whenever the user presses a key in the text box.
224
+ proc keypress {w c} {
225
+
226
+ # Update the current state
227
+ if {($c eq "") || ($c eq "\b") || ($c eq "\t") || ($c eq "\n") || ($c eq "\r")} {
228
+ handle_state $w 0
229
+ } else {
230
+ handle_state $w 1
231
+ }
232
+
233
+ }
234
+
235
+ ###########################################################################
236
+ # Handles any sort of movement of the insertion cursor or selection within
237
+ # the entry widget.
238
+ proc handle_text_movement {w} {
239
+
240
+ variable state
241
+
242
+ # If we are empty, always set the insertion cursor to 1.0
243
+ if {$state($w) eq "empty"} {
244
+ $w.e icursor 0
245
+ $w.e selection clear
246
+ focus $w.e
247
+ return 1
248
+ }
249
+
250
+ return 0
251
+
252
+ }
253
+
254
+ ###########################################################################
255
+ # Handles a Control-x binding on the given widget.
256
+ proc handle_cut {w} {
257
+
258
+ if {![$w.e selection present]} {
259
+ clipboard clear
260
+ clipboard append [$w.txt get]
261
+ $w.e delete 0 end
262
+ handle_state $w 1
263
+ } else {
264
+ clipboard clear
265
+ clipboard append [string range [$w.e get] [$w.e index sel.first] [$w.e index sel.last]]
266
+ $w.e delete sel.first sel.last
267
+ handle_state $w 1
268
+ }
269
+
270
+ }
271
+
272
+ ###########################################################################
273
+ # Handles a Control-c binding on the given widget.
274
+ proc handle_copy {w} {
275
+
276
+ if {![$w.e selection present]} {
277
+ clipboard clear
278
+ clipboard append [$w.e get]
279
+ } else {
280
+ clipboard clear
281
+ clipboard append [string range [$w.e get] [$w.e index sel.first] [$w.e index sel.last]]
282
+ }
283
+
284
+ }
285
+
286
+ ###########################################################################
287
+ # Handles a Control-v binding on the given widget.
288
+ proc handle_paste {w} {
289
+
290
+ # Handle the current state
291
+ handle_state $w 1
292
+
293
+ # Insert the clipboard text
294
+ $w.e insert insert [clipboard get]
295
+
296
+ }
297
+
298
+ ###########################################################################
299
+ # Handles the current state of the widget (empty/non-empty) and handles
300
+ # any watermark display (or removal of the display).
301
+ proc handle_state {w keyed} {
302
+
303
+ variable state
304
+ variable options
305
+
306
+ # If we are in the empty state
307
+ if {$state($w) eq "empty"} {
308
+
309
+ $w.e delete 0 end
310
+
311
+ if {$keyed} {
312
+ set state($w) "non-empty"
313
+ $w.e configure -foreground $options($w,-foreground)
314
+ } else {
315
+ $w.e configure -foreground $options($w,-watermarkforeground)
316
+ $w.e insert end $options($w,-watermark)
317
+ $w.e icursor 0
318
+ }
319
+
320
+ # Otherwise, we are in the not-empty state
321
+ } elseif {$state($w) eq "non-empty"} {
322
+
323
+ # If the widget is empty, set the state to empty and fill it with the
324
+ # empty string.
325
+ after idle [list wmarkentry::handle_non_empty_state $w]
326
+
327
+ }
328
+
329
+ }
330
+
331
+ ###########################################################################
332
+ # Handles the non-empty state of the widget.
333
+ proc handle_non_empty_state {w} {
334
+
335
+ variable state
336
+ variable options
337
+
338
+ if {[string trim [$w.e get]] eq ""} {
339
+ set state($w) "empty"
340
+ $w.e configure -foreground $options($w,-watermarkforeground)
341
+ $w.e insert end $options($w,-watermark)
342
+ $w.e icursor 0
343
+ }
344
+
345
+ }
346
+
347
+ ###########################################################################
348
+ # Handles a specified textvariable read/write request.
349
+ proc handle_textvariable {w name1 name2 op} {
350
+
351
+ variable options
352
+
353
+ if {$options($w,-textvariable) eq $name1} {
354
+ upvar #0 $options($w,-textvariable) textvar
355
+ if {$op eq "write"} {
356
+ delete $w 0 end
357
+ insert $w end $textvar
358
+ } elseif {$op eq "read"} {
359
+ set textvar [get $w]
360
+ }
361
+ }
362
+
363
+ }
364
+
365
+ ###########################################################################
366
+ # Handles all commands.
367
+ proc widget_cmd {w args} {
368
+
369
+ if {[llength $args] == 0} {
370
+ return -code error "wmarkentry widget called without a command"
371
+ }
372
+
373
+ set cmd [lindex $args 0]
374
+ set opts [lrange $args 1 end]
375
+
376
+ switch $cmd {
377
+ configure { return [eval "wmarkentry::configure 0 $w $opts"] }
378
+ cget { return [eval "wmarkentry::cget $w $opts"] }
379
+ insert { return [eval "wmarkentry::insert $w $opts"] }
380
+ delete { return [eval "wmarkentry::delete $w $opts"] }
381
+ get { return [eval "wmarkentry::get $w"] }
382
+ selection { return [eval "wmarkentry::selection $w $opts"] }
383
+ icursor { return [eval "wmarkentry::icursor $w $opts"] }
384
+ index { return [eval "wmarkentry::index $w $opts"] }
385
+ default { return [eval "$w.e $cmd $opts"] }
386
+ }
387
+
388
+ }
389
+
390
+ ###########################################################################
391
+ # USER COMMANDS
392
+ ###########################################################################
393
+
394
+ ###########################################################################
395
+ # Main configuration routine.
396
+ proc configure {initialize w args} {
397
+
398
+ variable options
399
+ variable entry_options
400
+ variable widget_options
401
+ variable state
402
+
403
+ if {([llength $args] == 0) && !$initialize} {
404
+
405
+ set results [list]
406
+
407
+ foreach opt [lsort [array names widget_options]] {
408
+ if {[llength $widget_options($opt)] == 2} {
409
+ set opt_name [lindex $widget_options($opt) 0]
410
+ set opt_class [lindex $widget_options($opt) 1]
411
+ set opt_default [option get $w $opt_name $opt_class]
412
+ if {[info exists entry_options($opt)]} {
413
+ lappend results [list $opt $opt_name $opt_class $opt_default [$w.e cget $opt]]
414
+ } elseif {[info exists options($w,$opt)]} {
415
+ lappend results [list $opt $opt_name $opt_class $opt_default $options($w,$opt)]
416
+ } else {
417
+ lappend results [list $opt $opt_name $opt_class $opt_default ""]
418
+ }
419
+ }
420
+ }
421
+
422
+ return $results
423
+
424
+ } elseif {([llength $args] == 1) && !$initialize} {
425
+
426
+ set opt [lindex $args 0]
427
+
428
+ if {[info exists widget_options($opt)]} {
429
+ if {[llength $widget_options($opt)] == 1} {
430
+ set opt [lindex $widget_options($opt) 0]
431
+ }
432
+ set opt_name [lindex $widget_options($opt) 0]
433
+ set opt_class [lindex $widget_options($opt) 1]
434
+ set opt_default [option get $w $opt_name $opt_class]
435
+ if {[info exists entry_options($opt)]} {
436
+ return [list $opt $opt_name $opt_class $opt_default [$w.e cget $opt]]
437
+ } elseif {[info exists options($w,$opt)]} {
438
+ return [list $opt $opt_name $opt_class $opt_default $options($w,$opt)]
439
+ } else {
440
+ return [list $opt $opt_name $opt_class $opt_default ""]
441
+ }
442
+ }
443
+
444
+ return -code error "WMarkEntry configuration option [lindex $args 0] does not exist"
445
+
446
+ } else {
447
+
448
+ # Save the original contents
449
+ array set orig_options [array get options]
450
+
451
+ # Parse the arguments
452
+ foreach {name value} $args {
453
+ if {$name eq "-fg"} {
454
+ set name "-foreground"
455
+ }
456
+ if {[info exists entry_options($name)]} {
457
+ $w.e configure $name $value
458
+ } elseif {[info exists options($w,$name)]} {
459
+ set options($w,$name) $value
460
+ } else {
461
+ return -code error "Illegal option given to the wmarkentry configure command ($name)"
462
+ }
463
+ }
464
+
465
+ # Handle the textvariable option, if it was specified
466
+ if {$orig_options($w,-textvariable) ne $options($w,-textvariable)} {
467
+ catch "trace remove variable $orig_options($w,-textvariable) {write read} {wmarkentry::handle_textvariable $w}"
468
+ if {$options($w,-textvariable) ne ""} {
469
+ trace add variable $options($w,-textvariable) {write read} "wmarkentry::handle_textvariable $w"
470
+ handle_textvariable $w $options($w,-textvariable) "" write
471
+ }
472
+ }
473
+
474
+ # Make sure that the state is handled correctly
475
+ handle_state $w 0
476
+
477
+ }
478
+
479
+ }
480
+
481
+ ###########################################################################
482
+ # Gets configuration option value(s).
483
+ proc cget {w args} {
484
+
485
+ variable options
486
+ variable entry_options
487
+
488
+ if {[llength $args] != 1} {
489
+ return -code error "Incorrect number of parameters given to the wmarkentry cget command"
490
+ }
491
+
492
+ if {[set name [lindex $args 0]] eq "-fg"} {
493
+ set name "-foreground"
494
+ }
495
+
496
+ if {[info exists entry_options($name)]} {
497
+ return [$w.e cget $name]
498
+ } elseif {[info exists options($w,$name)]} {
499
+ return $options($w,$name)
500
+ } else {
501
+ return -code error "Illegal option given to the wmarkentry cget command ([lindex $args 0])"
502
+ }
503
+
504
+ }
505
+
506
+ ###########################################################################
507
+ # Wrapper around the entry insert command. Handles any needed changes to the
508
+ # watermark.
509
+ proc insert {w args} {
510
+
511
+ # If the user is inserted a non-empty string of data, make sure the state
512
+ # is handled properly.
513
+ if {[lindex $args 1] ne ""} {
514
+ handle_state $w 1
515
+ } else {
516
+ handle_state $w 0
517
+ }
518
+
519
+ return [eval "$w.e insert $args"]
520
+
521
+ }
522
+
523
+ ###########################################################################
524
+ # Wrapper around the entry delete command. Handles any needed changes to the
525
+ # watermark.
526
+ proc delete {w args} {
527
+
528
+ # Perform the deletion command
529
+ set retval [eval "$w.e delete $args"]
530
+
531
+ # Handle any needed state changes
532
+ handle_state $w 1
533
+
534
+ }
535
+
536
+ ###########################################################################
537
+ # Wrapper around the entry get command. Handles the case where the state is
538
+ # empty (returns empty string).
539
+ proc get {w} {
540
+
541
+ variable state
542
+
543
+ if {$state($w) eq "empty"} {
544
+ return ""
545
+ } else {
546
+ return [$w.e get]
547
+ }
548
+
549
+ }
550
+
551
+ ###########################################################################
552
+ # Wrapper around the entry selection command. Handles any needed changes
553
+ # to the watermark.
554
+ proc selection {w args} {
555
+
556
+ variable state
557
+
558
+ switch [lindex $args 0] {
559
+ adjust {
560
+ if {$state($w) eq "empty"} {
561
+ return [$w.e selection adjust 0]
562
+ } else {
563
+ return [eval "$w.e selection $args"]
564
+ }
565
+ }
566
+ clear {
567
+ return [eval "$w.e selection $args"]
568
+ }
569
+ from {
570
+ if {$state($w) eq "empty"} {
571
+ return [$w.e selection from 0]
572
+ } else {
573
+ return [eval "$w.e selection $args"]
574
+ }
575
+ }
576
+ present {
577
+ if {$state($w) eq "empty"} {
578
+ return 0
579
+ } else {
580
+ return [eval "$w.e selection present"]
581
+ }
582
+ }
583
+ range {
584
+ if {$state($w) ne "empty"} {
585
+ eval "$w.e selection $args"
586
+ }
587
+ }
588
+ to {
589
+ if {$state($w) eq "empty"} {
590
+ return [$w.e selection to 0]
591
+ } else {
592
+ return [eval "$w.e selection $args"]
593
+ }
594
+ }
595
+ }
596
+
597
+ }
598
+
599
+ ###########################################################################
600
+ # Wrapper around the entry icursor command. Handles any needed changes
601
+ # to the watermark.
602
+ proc icursor {w args} {
603
+
604
+ variable state
605
+
606
+ if {$state($w) eq "empty"} {
607
+ return [$w.e icursor 0]
608
+ } else {
609
+ return [eval "$w.e icursor $args"]
610
+ }
611
+
612
+ }
613
+
614
+ ###########################################################################
615
+ # Wrapper around the entry index command.
616
+ proc index {w args} {
617
+
618
+ variable state
619
+
620
+ if {($state($w) eq "empty") && ([lindex $args 0] eq "end")} {
621
+ return 0
622
+ } else {
623
+ return [eval "$w.e index $args"]
624
+ }
625
+
626
+ }
627
+
628
+ namespace export *
629
+
630
+ }