Check-in [d67d766fd4]
Not logged in
Overview
Comment: .login .tclshrc tcl_ft.vim vim_ft.vim tclreadlineCompleter.tcl
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d67d766fd450021673f6a05602c7bb855c6eedce
User & Date: johannes@zellner.org on 1999-09-17 16:42:10
Other Links: manifest | tags
Context
1999-09-18
02:31
src/tclreadline/tclreadline.c src/tclreadline/tclreadlineCompleter.tcl check-in: 7e22ff2cc0 user: johannes@zellner.org tags: trunk
1999-09-17
16:42
.login .tclshrc tcl_ft.vim vim_ft.vim tclreadlineCompleter.tcl check-in: d67d766fd4 user: johannes@zellner.org tags: trunk
00:44
Modified Files: src/tclcrystal/.tclcrystalrc src/tclcrystal/Makefile.in src/tclcrystal/configure.in src/tclcrystal/crystal.cc src/tclreadline/README src/tclreadline/tclreadlineCompleter.tcl src/tclreadline/tclreadlineSetup.tcl.in check-in: 1f6689ebb8 user: johannes@zellner.org tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified tclreadlineCompleter.tcl from [cb20dd6778] to [1c598840ba].

     1      1   # -*- tclsh -*-
     2         -# FILE: "/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
     3         -# LAST MODIFICATION: "Thu Sep 16 22:17:38 1999 (joze)"
            2  +# FILE: "/disk01/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
            3  +# LAST MODIFICATION: "Fri Sep 17 18:41:10 1999 (joze)"
     4      4   # (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
     5      5   # $Id$
     6      6   # ---
     7      7   #
     8      8   # tclreadline -- gnu readline for tcl
     9      9   # Copyright (C) 1999  Johannes Zellner
    10     10   #
................................................................................
    31     31   # TODO:
    32     32   #
    33     33   #	- tcltest is missing
    34     34   #	- better completion for CompleteListFromList:
    35     35   #	  RemoveUsedOptions ...
    36     36   #	- namespace eval fred {... <-- continue with a 
    37     37   #								   substitution in fred.
           38  +#	- set tclreadline::pro<tab> geht *nicht*
           39  +#	  set ::tclreadline::pro<tab> geht
    38     40   #
    39     41   #
    40     42   
    41     43   
    42     44   
    43     45   namespace eval tclreadline {
    44     46   
................................................................................
   312    314   # @date Sep-14-1999
   313    315   #
   314    316   proc TrySubCmds {cmd} {
   315    317   	set trystring ____
   316    318   	set result ""
   317    319   	if [catch {set result [eval ${cmd} ${trystring}]} msg] {
   318    320   		set tcmd [string trim ${cmd}]
   319         -		if {[regexp {bad *option.*____.*: *must *be( .*$)} ${msg} all raw]} {
          321  +		# puts stderr msg=$msg
          322  +		if {[regexp {(bad|ambiguous) .*"____": *must *be( .*$)} ${msg} \
          323  +			all junk raw]
          324  +		} {; # XXX see tclIndexObj.c XXX
   320    325   			regsub -all -- , ${raw} { } raw
   321    326   			set len [llength ${raw}]
   322    327   			set len_2 [expr ${len} - 2]
   323    328   			for {set i 0} {${i} < ${len}} {incr i} {
   324    329   				set word [lindex ${raw} ${i}]
   325    330   				if {"or" != ${word} && ${i} != ${len_2}} {
   326    331   					lappend result ${word}
   327    332   				}
   328    333   
   329    334   			}
   330    335   		} elseif {[regexp "wrong # args: should be \"${tcmd}\(.*\)\"" \
   331    336   			${msg} all hint]
   332         -		} {
          337  +		} {; # XXX see tclIndexObj.c XXX
   333    338   			set result [string trim $hint]
   334    339   		} else {
   335    340   			# check, if it's a blt error msg ...
   336    341   			#
   337    342   			set msglst [split ${msg} \n]
   338    343   			foreach line ${msglst} {
   339    344   				if {[regexp "${tcmd}\[ \t\]\+\(\[^ \t\]*\)\[^:\]*$" \
................................................................................
   411    416   proc SplitLine {start line} {
   412    417   	set depth 0
   413    418   	# puts stderr SplitLine
   414    419   	for {set i $start} {$i >= 0} {incr i -1} {
   415    420   		set c [string index $line $i]
   416    421   		if {{;} == $c} {
   417    422   			incr i; # discard command break character
   418         -			return [list [expr $start - $i] [string range $line $i end]]
          423  +			return [list [expr $start - $i] [String range $line $i end]]
   419    424   		} elseif {{]} == $c} {
   420    425   			incr depth
   421    426   		} elseif {{[} == $c} {
   422    427   			incr depth -1
   423    428   			if {$depth < 0} {
   424    429   				incr i; # discard command break character
   425         -				return [list [expr $start - $i] [string range $line $i end]]
          430  +				return [list [expr $start - $i] [String range $line $i end]]
   426    431   			}
   427    432   		}
   428    433   	}
   429    434   	return ""
   430    435   }
   431    436   
   432    437   proc IsWhite {char} {
................................................................................
   608    613   	set last [expr [string length $line] - 1]
   609    614   	for {set i $last} {$i >= 0} {incr i -1} {
   610    615   		if {![catch {llength [string range $line 0 $i]}]} {
   611    616   			break
   612    617   		}
   613    618   	}
   614    619   	incr i
   615         -	return [string range $line $i end]
          620  +	return [String range $line $i end]
   616    621   }
   617    622   
   618    623   #**
   619    624   # save `lindex'. works also for non-complete lines
   620    625   # with opening parentheses or quotes.
   621    626   # usage as `lindex'.
   622    627   # Eventually returns the Rest of an incomplete line,
................................................................................
   641    646   	if {[catch [list set len [llength $line]]]} {
   642    647   		set line [ProperList $line]
   643    648   		if {[catch [list set len [llength $line]]]} { return {} }
   644    649   	}
   645    650   	# puts stderr \nline=$line
   646    651   	return $len
   647    652   }
          653  +
          654  +#**
          655  +# string function, which works also for older versions
          656  +# of tcl, which don't have the `end' index.
          657  +#
          658  +proc String args {
          659  +	if {[info tclversion] < 8.2} {
          660  +		switch [lindex $args 1] {
          661  +			range -
          662  +			index {
          663  +				if {"end" == [lindex $args end]} {
          664  +					set str [lindex $args 2]
          665  +					lreplace args end end [expr [string length $str] - 1]
          666  +				}
          667  +			}
          668  +		}
          669  +	}
          670  +	return [eval string $args]
          671  +}
   648    672   
   649    673   proc StripPrefix {text} {
   650    674   	# puts "(StripPrefix) text=|$text|"
   651    675   	set null [string index $text 0]
   652    676   	if {"\"" == $null || "\{" == $null} {
   653         -		return [string range $text 1 end]
          677  +		return [String range $text 1 end]
   654    678   	} else {
   655    679   		return $text
   656    680   	}
   657    681   }
   658    682   
   659    683   proc VarCompletion {text {level -1}} {
   660    684   	if {-1 == ${level}} {
................................................................................
   883    907   		}
   884    908   		set pos [expr ${idx} + 1]
   885    909   	}
   886    910   
   887    911   	if {![info exists cmd]} {return}
   888    912   	if {![info complete ${cmd}]} {return}
   889    913   	set cmd [string range ${cmd} 1 [expr [string length ${cmd}] - 2]]
   890         -	set rest [string range ${line} [expr ${idx} + 1] end]
          914  +	set rest [String range ${line} [expr ${idx} + 1] end]
   891    915   
   892    916   	if {[catch [list set result [string trim [eval ${cmd}]]]]} {return}
   893    917   
   894    918   	set line ${result}${rest}
   895    919   	set diff [expr [string length ${result}] - ([string length ${cmd}] + 2)]
   896    920   	incr start ${diff}
   897    921   	incr end ${diff}
................................................................................
   927    951   				return ""
   928    952   			}
   929    953   		}
   930    954   		# variable completion. Check first, if the
   931    955   		# variable starts with a plain `$' or should
   932    956   		# be enclosed in braces.
   933    957   		#
   934         -		set var [string range $part 1 end]
          958  +		set var [String range $part 1 end]
   935    959   
   936    960   		# check if $var is an array name, which
   937    961   		# already has already a "(" somewhere inside.
   938    962   		#
   939    963   		if {"" != [set vc [VarCompletion $var]]} {
   940    964   			if {"" == [lindex $vc 0]} {
   941    965   				return "\$ [lrange ${vc} 1 end]"
................................................................................
   978   1002   		return [TryFromList $part $all]
   979   1003   
   980   1004   	} else {
   981   1005   
   982   1006   		# try to use $pos further ...
   983   1007   		# puts stderr |$line|
   984   1008   		#
   985         -		if {"." == [string index [string trim ${line}] 0]} {
   986         -			set alias WIDGET
   987         -			set namespc ""; # widgets are always in the global
   988         -		} else {
         1009  +		# if {"." == [string index [string trim ${line}] 0]} {
         1010  +		# 	set alias WIDGET
         1011  +		# 	set namespc ""; # widgets are always in the global
         1012  +		# } else {
   989   1013   
   990   1014   			# the double `lindex' strips {} or quotes.
   991   1015   			# the subst enables variables containing
   992   1016   			# command names.
   993   1017   			#
   994   1018   			set alias [uplevel [info level] \
   995   1019   			subst [lindex [lindex [QuoteQuotes ${line}] 0] 0]]
................................................................................
  1003   1027   			}
  1004   1028   
  1005   1029   			# strip leading ::'s.
  1006   1030   			#
  1007   1031   			regsub -all {^::} $alias {} alias
  1008   1032   			set namespc [namespace qualifiers $alias]
  1009   1033   			set alias [namespace tail $alias]
  1010         -		}
         1034  +		# }
  1011   1035   
  1012   1036   		# try first a specific completer, then, and only then
  1013   1037   		# the tclreadline_complete_unknown.
  1014   1038   		#
  1015   1039   		foreach cmd [list ${alias} tclreadline_complete_unknown] {
  1016   1040   			# puts stderr ${namespc}complete(${cmd})
  1017   1041   			if {"" != [namespace eval ::tclreadline::${namespc} \
................................................................................
  1404   1428   		atan    exp     log10   tan 
  1405   1429   		atan2   floor   pow     tanh 
  1406   1430   		ceil    fmod    sin     abs 
  1407   1431   		double  int     rand    round 
  1408   1432   		srand 
  1409   1433   	}
  1410   1434   
  1411         -	if {[info tclversion] >= 8.2} {
  1412         -		set end end
  1413         -	} else {
  1414         -		set end [expr [string length $text] - 1]
  1415         -	}
  1416         -	if {")" == [string index $text $end] && -1 != [lsearch $cmds $left]} {
         1435  +	if {")" == [String index $text end] && -1 != [lsearch $cmds $left]} {
  1417   1436   		return "$text "; # append a space after a closing ')'
  1418   1437   	}
  1419   1438   
  1420   1439   	switch -- $left {
  1421   1440   		rand { return "rand() " }
  1422   1441   
  1423   1442   		abs  -
................................................................................
  2997   3016   			switch -- $cmd {
  2998   3017   				read {}
  2999   3018   				initialize {}
  3000   3019   				write {}
  3001   3020   				add { return [DisplayHints <completerLine>] }
  3002   3021   				completer { return [DisplayHints <line>] }
  3003   3022   				customcompleter { return [DisplayHints ?scriptCompleter?] }
  3004         -				builtincompleter { return [DisplayHints ?boolean?] }
         3023  +				builtincompleter { return [CompleteBoolean ${text}] }
  3005   3024   				eofchar { return [DisplayHints ?script?] }
  3006   3025   				reset-terminal {
  3007   3026   					if {[info exists ::env(TERM)]} {
  3008   3027   						return [CompleteFromList ${text} $::env(TERM)]
  3009   3028   					} else {
  3010   3029   						return [DisplayHints ?terminalName?]
  3011   3030   					}
................................................................................
  3220   3239   # @param command.
  3221   3240   # @param optionsT where the table will be stored.
  3222   3241   # @return number of options
  3223   3242   # @date Sep-14-1999
  3224   3243   #
  3225   3244   proc OptionTable {cmd optionsT} {
  3226   3245   	upvar $optionsT options
  3227         -	# first we build an option table
         3246  +	# first we build an option table.
         3247  +	# We always use `configure' here,
         3248  +	# because cget will not return the
         3249  +	# option table.
  3228   3250   	#
  3229         -	if {[catch [list set option_table [eval ${cmd}]] msg]} {
         3251  +	if {[catch [list set option_table [eval ${cmd} configure]] msg]} {
  3230   3252   		return 0
  3231   3253   	}
  3232   3254   	foreach optline ${option_table} {
  3233   3255   		if {5 != [llength ${optline}]} continue else {
  3234   3256   			lappend options(switches) [lindex ${optline} 0]
  3235   3257   			lappend options(value)    [lindex ${optline} 4]
  3236   3258   		}
................................................................................
  3254   3276   		if {-1 != ${idx}} {
  3255   3277   			break
  3256   3278   		}
  3257   3279   	}
  3258   3280   	if {-1 == ${idx}} {
  3259   3281   		return
  3260   3282   	}
  3261         -	set cmd [lrange ${lst} 0 ${idx}]
  3262         -	# puts stderr cmd=|$cmd|
         3283  +
         3284  +	# separate the command, but exclude (cget|configure)
         3285  +	# because cget won't return the option table. Instead
         3286  +	# OptionTable always uses `configure' to get the
         3287  +	# option table.
         3288  +	#
         3289  +	set cmd [lrange ${lst} 0 [expr ${idx} - 1]]
         3290  +
         3291  +	TraceText $cmd
  3263   3292   	if {0 < [OptionTable ${cmd} options]} {
  3264   3293   
  3265   3294   		set prev [PreviousWord ${start} ${line}]
  3266   3295   		if {-1 != [set found [lsearch -exact $options(switches) ${prev}]]} {
  3267   3296   
  3268   3297   			# complete only if the user has not
  3269   3298   			# already entered something here.
................................................................................
  3284   3313   }
  3285   3314   
  3286   3315   proc CompleteFromOptionsOrSubCmds {text start end line pos} {
  3287   3316   	set from_opts [CompleteFromOptions ${text} ${start} ${line}]
  3288   3317   	if {[string length ${from_opts}]} {
  3289   3318   		return ${from_opts}
  3290   3319   	} else {
         3320  +		# puts stderr \n\n[lrange [ProperList ${line}] 0 [expr $pos - 1]]\n
  3291   3321   		set cmds [TrySubCmds [lrange [ProperList ${line}] 0 [expr $pos - 1]]]
  3292         -		# puts stderr cmds=|$cmds|
  3293   3322   		if {[llength ${cmds}]} {
  3294   3323   			return [TryFromList ${text} ${cmds}]
  3295   3324   		}
  3296   3325   	}
  3297   3326   	return ""
  3298   3327   }
  3299   3328   
  3300         -proc complete(WIDGET) {text start end line pos mod} {
  3301         -	# set widget [Lindex ${line} 0]
  3302         -	# set cmds [TrySubCmds ${widget}]
  3303         -	# if {[llength ${cmds}]} {
  3304         -	# 	return [TryFromList ${mod} ${cmds}]
  3305         -	# }
         3329  +# TODO
         3330  +# write a dispatcher here, which gets the widget class name
         3331  +# and calls specific completers.
         3332  +#
         3333  +proc complete(WIDGET_COMMAND) {text start end line pos mod} {
  3306   3334   	return [CompleteFromOptionsOrSubCmds ${text} ${start} ${end} ${line} ${pos}]
  3307   3335   }
  3308   3336   
  3309         -# SPECIFIC TK COMMAND COMPLETERS
  3310         -
  3311         -proc complete(bell) {text start end line pos mod} {
  3312         -	switch -- ${pos} {
  3313         -		1 { return [CompleteFromList ${text} -displayof] }
  3314         -		2 {
  3315         -			if {"-displayof" == [PreviousWord ${start} ${line}]} {
  3316         -				return [CompleteFromList ${text} [ToplevelWindows]]
  3317         -			}
  3318         -		}
  3319         -	}
  3320         -}
  3321         -
  3322   3337   proc EventuallyInsertLeadingDot {text fallback} {
  3323   3338   	if {![string length ${text}]} {
  3324   3339   		return [list . {}]
  3325   3340   	} else {
  3326   3341   		return [DisplayHints $fallback]
  3327   3342   	}
  3328   3343   }
  3329   3344   
  3330   3345   #**
  3331   3346   # TODO: shit. make this better!
  3332         -# @param text, a std completer argument (current word).
  3333         -# @param fullpart, the full text of the current position.
  3334         -# @param lst, the list to complete from.
  3335         -# @param pre, leading `quote'.
  3336         -# @param sep, word separator.
  3337         -# @param post, trailing `quote'.
         3347  +# @param  text, a std completer argument (current word).
         3348  +# @param  fullpart, the full text of the current position.
         3349  +# @param  lst, the list to complete from.
         3350  +# @param  pre, leading `quote'.
         3351  +# @param  sep, word separator.
         3352  +# @param  post, trailing `quote'.
  3338   3353   # @return a formatted completer string.
  3339         -# @date Sep-15-1999
         3354  +# @date   Sep-15-1999
  3340   3355   #
  3341   3356   proc CompleteListFromList {text fullpart lst pre sep post} {
  3342   3357   
  3343   3358   	# puts stderr ""
  3344   3359   	# puts stderr text=|$text|
  3345   3360   	# puts stderr lst=|$lst|
  3346   3361   	# puts stderr pre=|$pre|
................................................................................
  3394   3409   	} elseif {[string length ${left}]} {
  3395   3410   		return [list ${left}]${completion}
  3396   3411   	} else {
  3397   3412   		return ${completion}
  3398   3413   	}
  3399   3414   	return ""
  3400   3415   }
         3416  +
         3417  +#**
         3418  +# SpecificSwitchCompleter
         3419  +# ---
         3420  +# @param    text   -- the word to complete.
         3421  +# @param    start  -- the char index of text's start in line
         3422  +# @param    line   -- the line gathered so far.
         3423  +# @param    switch -- the switch to complete for.
         3424  +# @return   a std tclreadline formatted completer string.
         3425  +# @sa       CompleteWidgetConfigurations
         3426  +# @date     Sep-17-1999
         3427  +#
         3428  +proc SpecificSwitchCompleter {text start line switch} {
         3429  +	# TODO:
         3430  +	#   go to the `options' man page and look for possible values
         3431  +	switch -- ${switch} {
         3432  +		-takefocus -
         3433  +		-exportselection { return [CompleteBoolean ${text}] }
         3434  +		-xscrollcommand -
         3435  +		-yscrollcommand {
         3436  +			# return [BraceOrCommand ${text} \
         3437  +			# ${start} ${end} ${line} ${pos} ${mod}]
         3438  +		}
         3439  +		-relief {
         3440  +			return [CompleteFromList ${text} {
         3441  +				raised sunken flat ridge solid groove
         3442  +			}]
         3443  +		}
         3444  +		default { return [DisplayHints <[String range ${prev} 1 end]>] }
         3445  +	}
         3446  +}
         3447  +
         3448  +#**
         3449  +# CompleteWidgetConfigurations
         3450  +# ---
         3451  +# @param    text  -- the word to complete.
         3452  +# @param    start -- the actual cursor position.
         3453  +# @param    line  -- the line gathered so far.
         3454  +# @param    lst   -- a list of possible completions.
         3455  +# @return   a std tclreadline formatted completer string.
         3456  +# @sa       SpecificSwitchCompleter
         3457  +# @date     Sep-17-1999
         3458  +#
         3459  +proc CompleteWidgetConfigurations {text start line lst} {
         3460  +	set prev [PreviousWord ${start} ${line}]
         3461  +	if {"-" == [string index ${prev} 0]} {
         3462  +		return [SpecificSwitchCompleter ${text} ${start} ${line} ${prev}]
         3463  +	} else {
         3464  +		return [CompleteFromList ${text} \
         3465  +		[RemoveUsedOptions ${line} ${lst}]]
         3466  +	}
         3467  +}
         3468  +
         3469  +# --------------------------------------
         3470  +# === SPECIFIC TK COMMAND COMPLETERS ===
         3471  +# --------------------------------------
         3472  +
         3473  +proc complete(bell) {text start end line pos mod} {
         3474  +	switch -- ${pos} {
         3475  +		1 { return [CompleteFromList ${text} -displayof] }
         3476  +		2 {
         3477  +			if {"-displayof" == [PreviousWord ${start} ${line}]} {
         3478  +				return [CompleteFromList ${text} [ToplevelWindows]]
         3479  +			}
         3480  +		}
         3481  +	}
         3482  +}
  3401   3483   
  3402   3484   proc complete(bind) {text start end line pos mod} {
  3403   3485   	switch -- ${pos} {
  3404   3486   		1 {
  3405   3487   			set widgets [WidgetChildren ${text}]
  3406   3488   			set toplevels [ToplevelWindows]
  3407   3489   			if {[catch {set toplevelClass [winfo class .]}]} {
................................................................................
  3450   3532   			return [CompleteListFromList ${text} [Lindex ${line} 2] \
  3451   3533   			[bindtags [Lindex ${line} 1]] \{ { } \}]
  3452   3534   		}
  3453   3535   	}
  3454   3536   	return ""
  3455   3537   }
  3456   3538   
  3457         -proc CompleteWidgetConfigurations {text start line lst} {
  3458         -	prev [PreviousWord ${start} ${line}]
  3459         -}
  3460         -
  3461   3539   proc complete(button) {text start end line pos mod} {
  3462   3540   	switch -- ${pos} {
  3463   3541   		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
  3464   3542   		default {
  3465         -			return [CompleteWidgetConfigurations ${text} {
         3543  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3544  +				-activebackground -activeforeground -anchor
         3545  +				-background -bitmap -borderwidth -cursor
         3546  +				-disabledforeground -font -foreground
         3547  +				-highlightbackground -highlightcolor
         3548  +				-highlightthickness -image -justify
         3549  +				-padx -pady -relief -takefocus -text
         3550  +				-textvariable -underline -wraplength
         3551  +				-command -default -height -state -width
         3552  +			}]
         3553  +		}
         3554  +	}
         3555  +	return ""
         3556  +}
         3557  +
         3558  +proc complete(canvas) {text start end line pos mod} {
         3559  +	switch -- ${pos} {
         3560  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3561  +		default {
         3562  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3563  +				-background -borderwidth -cursor -highlightbackground
         3564  +				-highlightcolor -highlightthickness -insertbackground
         3565  +				-insertborderwidth -insertofftime -insertontime
         3566  +				-insertwidth -relief -selectbackground -selectborderwidth
         3567  +				-selectforeground -takefocus -xscrollcommand -yscrollcommand
         3568  +				-closeenough -confine -height -scrollregion -width
         3569  +				-xscrollincrement -yscrollincrement
         3570  +			}]
         3571  +		}
         3572  +	}
         3573  +	return ""
         3574  +}
         3575  +
         3576  +proc complete(checkbutton) {text start end line pos mod} {
         3577  +	switch -- ${pos} {
         3578  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3579  +		default {
         3580  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3581  +				-activebackground activeBackground Foreground 
         3582  +				-activeforeground -anchor -background -bitmap
         3583  +				-borderwidth -cursor -disabledforeground -font
         3584  +				-foreground -highlightbackground -highlightcolor
         3585  +				-highlightthickness -image -justify -padx -pady
         3586  +				-relief -takefocus -text -textvariable -underline
         3587  +				-wraplength -command -height -indicatoron -offvalue
         3588  +				-onvalue -selectcolor -selectimage -state -variable
         3589  +				-width
         3590  +			}]
         3591  +		}
         3592  +	}
         3593  +	return ""
         3594  +}
         3595  +
         3596  +proc complete(entry) {text start end line pos mod} {
         3597  +	switch -- ${pos} {
         3598  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3599  +		default {
         3600  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3601  +				-background -borderwidth -cursor -exportselection
         3602  +				-font -foreground -highlightbackground -highlightcolor
         3603  +				-highlightthickness -insertbackground -insertborderwidth
         3604  +				-insertofftime -insertontime -insertwidth -justify -relief
         3605  +				-selectbackground -selectborderwidth -selectforeground
         3606  +				-takefocus -textvariable -xscrollcommand -show -state
         3607  +				-width
         3608  +			}]
         3609  +		}
         3610  +	}
         3611  +	return ""
         3612  +}
         3613  +
         3614  +proc complete(frame) {text start end line pos mod} {
         3615  +	switch -- ${pos} {
         3616  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3617  +		default {
         3618  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3619  +				-borderwidth -cursor -highlightbackground -highlightcolor
         3620  +				-highlightthickness -relief -takefocus -background
         3621  +				-class -colormap -container -height -visual -width
         3622  +			}]
         3623  +		}
         3624  +	}
         3625  +	return ""
         3626  +}
         3627  +
         3628  +proc complete(label) {text start end line pos mod} {
         3629  +	switch -- ${pos} {
         3630  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3631  +		default {
         3632  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3633  +				-anchor -background -bitmap -borderwidth -cursor -font
         3634  +				-foreground -highlightbackground -highlightcolor
         3635  +				-highlightthickness -image -justify -padx -pady -relief
         3636  +				-takefocus -text -textvariable -underline -wraplength
         3637  +				-height -width
         3638  +			}]
         3639  +		}
         3640  +	}
         3641  +	return ""
         3642  +}
         3643  +
         3644  +proc complete(listbox) {text start end line pos mod} {
         3645  +	switch -- ${pos} {
         3646  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3647  +		default {
         3648  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3649  +				-background -borderwidth -cursor -exportselection -font
         3650  +				-foreground -height -highlightbackground -highlightcolor
         3651  +				-highlightthickness -relief -selectbackground
         3652  +				-selectborderwidth -selectforeground -setgrid -takefocus
         3653  +				-width -xscrollcommand -yscrollcommand -height -selectmode
         3654  +				-width
         3655  +			}]
         3656  +		}
         3657  +	}
         3658  +	return ""
         3659  +}
         3660  +
         3661  +proc complete(menu) {text start end line pos mod} {
         3662  +	switch -- ${pos} {
         3663  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3664  +		default {
         3665  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3666  +				-activebackground -activeborderwidth -activeforeground
         3667  +				-background -borderwidth -cursor -disabledforeground
         3668  +				-font -foreground -relief -takefocus -postcommand
         3669  +				-selectcolor -tearoff -tearoffcommand -title -type
         3670  +			}]
         3671  +		}
         3672  +	}
         3673  +	return ""
         3674  +}
         3675  +
         3676  +proc complete(menubutton) {text start end line pos mod} {
         3677  +	switch -- ${pos} {
         3678  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3679  +		default {
         3680  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3681  +				-activebackground -activeforeground -anchor -background
         3682  +				-bitmap -borderwidth -cursor -disabledforeground -font
         3683  +				-foreground -highlightbackground -highlightcolor
         3684  +				-highlightthickness -image -justify -padx -pady -relief
         3685  +				-takefocus -text -textvariable -underline -wraplength
         3686  +				-direction -height -indicatoron -menu -state -width
         3687  +			}]
         3688  +		}
         3689  +	}
         3690  +	return ""
         3691  +}
         3692  +
         3693  +proc complete(message) {text start end line pos mod} {
         3694  +	switch -- ${pos} {
         3695  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3696  +		default {
         3697  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3698  +				-anchor -background -borderwidth -cursor -font -foreground
         3699  +				-highlightbackground -highlightcolor -highlightthickness
         3700  +				-padx -pady -relief -takefocus -text -textvariable -width 
         3701  +				-aspect -justify -width
         3702  +			}]
         3703  +		}
         3704  +	}
         3705  +	return ""
         3706  +}
         3707  +
         3708  +proc complete(radiobutton) {text start end line pos mod} {
         3709  +	switch -- ${pos} {
         3710  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3711  +		default {
         3712  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3713  +				-activebackground -activeforeground -anchor -background
         3714  +				-bitmap -borderwidth -cursor -disabledforeground -font
         3715  +				-foreground -highlightbackground -highlightcolor
         3716  +				-highlightthickness -image -justify -padx -pady -relief
         3717  +				-takefocus -text -textvariable -underline -wraplength -command
         3718  +				-height -indicatoron -selectcolor -selectimage -state -value
         3719  +				-variable -width
         3720  +			}]
         3721  +		}
         3722  +	}
         3723  +	return ""
         3724  +}
         3725  +
         3726  +proc complete(scale) {text start end line pos mod} {
         3727  +	switch -- ${pos} {
         3728  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3729  +		default {
         3730  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3731  +				-activebackground -background -borderwidth -cursor -font
         3732  +				-foreground -highlightbackground -highlightcolor
         3733  +				-highlightthickness -orient -relief -repeatdelay
         3734  +				-repeatinterval -takefocus -troughcolor -bigincrement
         3735  +				-command -digits -from -label -length -resolution
         3736  +				-showvalue -sliderlength -sliderrelief -state -tickinterval
         3737  +				-to -variable -width
         3738  +			}]
         3739  +		}
         3740  +	}
         3741  +	return ""
         3742  +}
         3743  +
         3744  +proc complete(scrollbar) {text start end line pos mod} {
         3745  +	switch -- ${pos} {
         3746  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3747  +		default {
         3748  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3749  +				-activebackground -background -borderwidth -cursor
         3750  +				-highlightbackground -highlightcolor -highlightthickness
         3751  +				-jump -orient -relief -repeatdelay -repeatinterval
         3752  +				-takefocus -troughcolor -activerelief -command
         3753  +				-elementborderwidth -width
         3754  +			}]
         3755  +		}
         3756  +	}
         3757  +	return ""
         3758  +}
         3759  +
         3760  +proc complete(text) {text start end line pos mod} {
         3761  +	switch -- ${pos} {
         3762  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3763  +		default {
         3764  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3765  +				-background -borderwidth -cursor -exportselection -font
         3766  +				-foreground -highlightbackground -highlightcolor
         3767  +				-highlightthickness -insertbackground -insertborderwidth
         3768  +				-insertofftime -insertontime -insertwidth -padx -pady
         3769  +				-relief -selectbackground -selectborderwidth
         3770  +				-selectforeground -setgrid -takefocus -xscrollcommand
         3771  +				-yscrollcommand -height -spacing1 -spacing2 -spacing3
         3772  +				-state -tabs -width -wrap
         3773  +			}]
         3774  +		}
         3775  +	}
         3776  +	return ""
         3777  +}
         3778  +
         3779  +proc complete(toplevel) {text start end line pos mod} {
         3780  +	switch -- ${pos} {
         3781  +		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
         3782  +		default {
         3783  +			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
         3784  +				-borderwidth -cursor -highlightbackground -highlightcolor
         3785  +				-highlightthickness -relief -takefocus -background
         3786  +				-class -colormap -container -height -menu -screen
         3787  +				-use -visual -width
  3466   3788   			}]
  3467   3789   		}
  3468   3790   	}
  3469   3791   	return ""
  3470   3792   }
  3471   3793   
  3472   3794   proc complete(image) {text start end line pos mod} {
  3473         -	set sub [Lindex ${line} 1]
         3795  +set sub [Lindex ${line} 1]
  3474   3796   	switch -- ${pos} {
  3475   3797   		1 { return [CompleteFromList ${text} [TrySubCmds image]] }
  3476   3798   		2 {
  3477   3799   			switch -- ${sub} {
  3478   3800   				create { return [CompleteFromList ${text} [image types]] }
  3479   3801   				delete -
  3480   3802   				height -