@@ -1,8 +1,8 @@ # -*- tclsh -*- # FILE: "/home/joze/src/tclreadline/tclreadlineCompleter.tcl" -# LAST MODIFICATION: "Sat Sep 18 04:27:54 1999 (joze)" +# LAST MODIFICATION: "Sun Sep 19 01:02:44 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -46,11 +46,11 @@ namespace export \ TryFromList CompleteFromList DisplayHints Rehash \ PreviousWord CommandCompletion RemoveUsedOptions \ HostList ChannelId InChannelId OutChannelId \ -Lindex Llength CompleteBoolean +Lindex Llength CompleteBoolean WidgetChildren # set tclreadline::trace to 1, if you # want to enable explicit trace calls. # variable trace @@ -142,18 +142,20 @@ proc TryFromList {text lst {allow ""} {inhibit 0}} { # puts stderr "(CompleteFromList) \ntext=|$text|" # puts stderr "(CompleteFromList) lst=|$lst|" set pre [GetQuotedPrefix ${text}] - set matches [MatchesFromList $text $lst $allow] + set matches [MatchesFromList ${text} ${lst} ${allow}] # puts stderr "(CompleteFromList) matches=|$matches|" if {1 == [llength $matches]} { ; # unique match # puts stderr \nunique=$matches\n # puts stderr "\n|${pre}${matches}[Right ${pre}]|\n" set null [string index $matches 0] - if {"<" == $null || "?" == $null} { + if {("<" == ${null} || "?" == ${null}) && \ + -1 == [string first ${null} ${allow}] + } { set completion [string trim "[list $text] $lst"] } else { set completion [string trim ${pre}${matches}[Right ${pre}]] } if {$inhibit} { @@ -180,12 +182,12 @@ # completes, if a completion can be done, or ring # the bell if not. If inhibit is non-zero, the result # will be formatted such that readline will not insert # a space after a complete (single) match. # -proc CompleteFromList {text lst {inhibit 0}} { - set result [TryFromList ${text} ${lst} "" $inhibit] +proc CompleteFromList {text lst {allow ""} {inhibit 0}} { + set result [TryFromList ${text} ${lst} ${allow} $inhibit] if {![llength ${result}]} { Alert # return [string trim [list ${text}] ${lst}"] if {[llength ${lst}]} { return [string trim "${text} ${lst}"] @@ -393,10 +395,37 @@ break } } return "" } + +#** +# try to get casses for commands which +# allow `configure' (cget). +# @param command. +# @param optionsT where the table will be stored. +# @return number of options +# @date Sat-Sep-18 +# +proc ClassTable {cmd} { + + # first we build an option table. + # We always use `configure' here, + # because cget will not return the + # option table. + # + if {[catch [list set option_table [eval ${cmd} configure]] msg]} { + return "" + } + set classes "" + foreach optline ${option_table} { + if {5 != [llength ${optline}]} continue else { + lappend classes [lindex ${optline} 2] + } + } + return ${classes} +} #** # try to get options for commands which # allow `configure' (cget). # @param command. @@ -535,11 +564,11 @@ # nothing typed so far. Insert a $pre # and inhibit further completion. # return [list ${pre} {}] - } elseif {[regexp ${post} ${text}]} { + } elseif {${post} == [String index ${text} end]} { # finalize, append the post and a space. # set diff \ [expr [CountChar ${fullpart} ${pre}] - [CountChar ${fullpart} ${post}]] @@ -567,11 +596,11 @@ if {1 == [llength ${exact_matches}] && -1 != [lsearch ${lst} ${right}] } { #set completion [CompleteFromList ${right} [list ${sep} ${post}] 1] return [list ${left}${right}${sep} {}] } else { - set completion [CompleteFromList ${right} ${lst} 1] + set completion [CompleteFromList ${right} ${lst} "" 1] } # puts stderr \ncompletion=|$completion| if {![string length [lindex $completion 0]]} { return [concat [list ${left}] [lrange $completion 1 end]] } elseif {[string length ${left}]} { @@ -685,10 +714,14 @@ return 1 } else { return 0 } } + +proc PreviousWordOfIncompletePosition {start line} { + return [lindex [ProperList [string range ${line} 0 ${start}]] end] +} proc PreviousWord {start line} { incr start -1 set found 0 for {set i $start} {$i > 0} {incr i -1} { @@ -898,10 +931,14 @@ } #** # string function, which works also for older versions # of tcl, which don't have the `end' index. +# I tried also defining `string' and thus overriding +# the builtin `string' which worked, but slowed down +# things considerably. So I decided to call `String' +# only if I really need the `end' index. # proc String args { if {[info tclversion] < 8.2} { switch [lindex $args 1] { range - @@ -925,14 +962,16 @@ return $text } } proc VarCompletion {text {level -1}} { - if {-1 == ${level}} { - set level [info level] - } else { - incr level + if {"#" != [string index ${level} 0]} { + if {-1 == ${level}} { + set level [info level] + } else { + incr level + } } set pre [GetQuotedPrefix ${text}] set var [StripPrefix ${text}] # puts stderr "(VarCompletion) pre=|$pre|" # puts stderr "(VarCompletion) var=|$var|" @@ -2662,11 +2701,11 @@ # 2 { return [DisplayHints ?access?] } switch -- $pos { 2 { set access {r r+ w w+ a a+ RDONLY WRONLY RDWR APPEND CREAT EXCL NOCTTY NONBLOCK TRUNC} - return [CompleteFromList ${text} $access] + return [CompleteFromList ${text} ${access}] } 3 { return [DisplayHints ?permissions?] } } return "" } @@ -2679,11 +2718,11 @@ forget ifneeded names present provide require unknown vcompare versions vsatisfies} return [TryFromList $text $cmds] } 2 { - switch -- $cmd { + switch -- ${cmd} { forget - ifneeded - provide - versions { return [CompleteFromList ${mod} [package names]] } present - @@ -2695,23 +2734,23 @@ vsatisfies { return [DisplayHints ] } } } 3 { set versions "" - catch [list set versions [package versions [Lindex $line 2]]] - switch -- $cmd { + catch [list set versions [package versions [Lindex ${line} 2]]] + switch -- ${cmd} { forget {} ifneeded { if {"" != $versions} { - return [CompleteFromList ${text} $versions] + return [CompleteFromList ${text} ${versions}] } else { return [DisplayHints ] } } provide { - if {"" != $versions} { - return [CompleteFromList ${text} $versions] + if {"" != ${versions}} { + return [CompleteFromList ${text} ${versions}] } else { return [DisplayHints ?version?] } } versions {} @@ -2718,12 +2757,12 @@ present - require { if {"-exact" == [PreviousWord ${start} ${line}]} { return [CompleteFromList ${mod} [package names]] } else { - if {"" != $versions} { - return [CompleteFromList ${text} $versions] + if {"" != ${versions}} { + return [CompleteFromList ${text} ${versions}] } else { return [DisplayHints ?version?] } } } @@ -2736,47 +2775,48 @@ } return "" } proc complete(pid) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [ChannelId ${text}] } } } proc complete(pkg_mkIndex) {text start end line pos mod} { set cmds [RemoveUsedOptions ${line} {-direct -load -verbose -- } {--}] - set res [string trim [TryFromList $text $cmds]] + set res [string trim [TryFromList ${text} ${cmds}]] set prev [PreviousWord ${start} ${line}] - if {"-load" == $prev} { + if {"-load" == ${prev}} { return [DisplayHints ] - } elseif {"--" == $prev} { + } elseif {"--" == ${prev}} { return [TryFromList ${text} ] } return ${res} } proc complete(proc) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { set known_procs [ProcsOnlyCompletion ${text}] return [CompleteFromList ${text} ${known_procs}] } 2 { - set proc [Lindex $line 1] + set proc [Lindex ${line} 1] if {[catch {set args [uplevel [info level] info args ${proc}]}]} { return [DisplayHints ] } else { return [list "\{${args}\}"] } } 3 { - if {![string length [Lindex $line $pos]]} { + if {![string length [Lindex ${line} ${pos}]]} { return [list \{ {}]; # \} } else { # return [DisplayHints ] - return [BraceOrCommand $text $start $end $line $pos $mod] + return [BraceOrCommand \ + ${text} ${start} ${end} ${line} ${pos} ${mod}] } } } return "" } @@ -2827,11 +2867,11 @@ ("-" == [string index ${prev} 0] || 1 == $pos)} { set cmds [RemoveUsedOptions ${line} { -nocase -indices -expanded -line -linestop -lineanchor -about --} {--}] if {[llength ${cmds}]} { - return [string trim [CompleteFromList $text $cmds]] + return [string trim [CompleteFromList ${text} ${cmds}]] } } else { set virtual_pos [expr ${pos} - [FirstNonOption ${line}]] switch -- ${virtual_pos} { 0 { return [DisplayHints ] } @@ -2847,15 +2887,15 @@ # } proc complete(regsub) {text start end line pos mod} { set prev [PreviousWord ${start} ${line}] if {[llength ${prev}] && "--" != $prev && \ - ("-" == [string index ${prev} 0] || 1 == $pos)} { + ("-" == [string index ${prev} 0] || 1 == ${pos)}} { set cmds [RemoveUsedOptions ${line} { -all -nocase --} {--}] if {[llength ${cmds}]} { - return [string trim [CompleteFromList $text $cmds]] + return [string trim [CompleteFromList ${text} ${cmds}]] } } else { set virtual_pos [expr ${pos} - [FirstNonOption ${line}]] switch -- ${virtual_pos} { 0 { return [DisplayHints ] } @@ -2868,11 +2908,11 @@ } proc complete(rename) {text start end line pos mod} { switch -- $pos { 1 { - return [CompleteFromList $text [CommandCompletion $text]] + return [CompleteFromList ${text} [CommandCompletion ${text}]] } 2 { return [DisplayHints ] } } @@ -2908,11 +2948,12 @@ namespace import \ ::tclreadline::DisplayHints ::tclreadline::PreviousWord \ ::tclreadline::CompleteFromList ::tclreadline::CommandCompletion \ ::tclreadline::RemoveUsedOptions ::tclreadline::HostList \ ::tclreadline::ChannelId ::tclreadline::Lindex \ - ::tclreadline::CompleteBoolean + ::tclreadline::CompleteBoolean \ + ::tclreadline::WidgetChildren } variable opts set opts { -accessPath -statics -noStatics -nested -nestedLoadOk -deleteHook } @@ -2934,76 +2975,97 @@ } } } proc safe::complete(interpCreate) {text start end line pos mod} { - return [SlaveOrOpts $text $start $line $pos ?slave?] + return [SlaveOrOpts ${text} ${start} ${line} ${pos} ?slave?] } proc safe::complete(interpInit) {text start end line pos mod} { - return [SlaveOrOpts $text $start $line $pos [interp slaves]] + return [SlaveOrOpts ${text} ${start} ${line} ${pos} [interp slaves]] } proc safe::complete(interpConfigure) {text start end line pos mod} { return [SlaveOrOpts $text $start $line $pos [interp slaves]] } proc safe::complete(interpDelete) {text start end line pos mod} { - return [CompleteFromList $text [interp slaves]] + return [CompleteFromList ${text} [interp slaves]] } proc safe::complete(interpAddToAccessPath) {text start end line pos mod} { - switch -- $pos { - 1 { return [CompleteFromList $text [interp slaves]] } + switch -- ${pos} { + 1 { return [CompleteFromList ${text} [interp slaves]] } } } proc safe::complete(interpFindInAccessPath) {text start end line pos mod} { - switch -- $pos { - 1 { return [CompleteFromList $text [interp slaves]] } + switch -- ${pos} { + 1 { return [CompleteFromList ${text} [interp slaves]] } } } proc safe::complete(setLogCmd) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [DisplayHints ?cmd?] } default { return [DisplayHints ?arg?] } } } + +proc safe::complete(loadTk) {text start end line pos mod} { + switch -- ${pos} { + 1 { return [DisplayHints ] } + default { + switch -- [PreviousWord ${start} ${line}] { + -use { + return [CompleteFromList ${text} \ + [::tclreadline::WidgetChildren ${text}]] + } + -display { + return [DisplayHints ] + } + default { + return [CompleteFromList ${text} \ + [RemoveUsedOptions ${line} {-use -display}]] + } + } + } + } +} # --- END OF SAFE PACKAGE --- proc complete(scan) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [DisplayHints ] } 2 { return [DisplayHints ] } default { return [VarCompletion ${text}] } } return "" } proc complete(seek) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [ChannelId ${text}] } 2 { return [DisplayHints ] } 3 { return [TryFromList ${text} {start current end}] } } return "" } proc complete(set) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [VarCompletion ${text}] } 2 { - if {$text == "" || $text == "\"" || $text == "\{"} { + if {${text} == "" || ${text} == "\"" || ${text} == "\{"} { # set line [QuoteQuotes $line] if {[catch [list set value [list [uplevel [info level] \ - set [Lindex $line 1]]]] msg] + set [Lindex ${line} 1]]]] msg] } { return "" } else { - return [Quote $value ${text}] + return [Quote ${value} ${text}] } } } } return "" @@ -3013,14 +3075,14 @@ set cmd [Lindex ${line} 1] set prev [PreviousWord ${start} ${line}] if {"-server" == ${cmd}} { # server sockets # - switch -- $pos { + switch -- ${pos} { 2 { return [DisplayHints ] } default { - if {"-myaddr" == $prev} { + if {"-myaddr" == ${prev}} { return [DisplayHints ] } else { return [CompleteFromList ${mod} \ [RemoveUsedOptions $line {-myaddr -error -sockname }]] } @@ -3034,28 +3096,30 @@ -myport { return [DisplayHints ] } } set hosts [HostList] set cmds {-myaddr -myport -async -myaddr -error -sockname -peername} - if {$pos <= 1} { + if {${pos} <= 1} { lappend cmds -server } - set cmds [RemoveUsedOptions $line $cmds] - if {-1 != [lsearch $hosts $prev]} { + set cmds [RemoveUsedOptions ${line} ${cmds}] + if {-1 != [lsearch ${hosts} ${prev}]} { return [DisplayHints ] } else { return [CompleteFromList ${mod} [concat ${cmds} ${hosts}]] } } return "" } -# proc complete(source) {text start end line pos mod} { -# } +proc complete(source) {text start end line pos mod} { + # allow file name completion + return "" +} proc complete(split) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [DisplayHints ] } 2 { return [DisplayHints ?splitChars?] } } } @@ -3064,16 +3128,16 @@ set prev [PreviousWord ${start} ${line}] set cmds { bytelength compare equal first index is last length map match range repeat replace tolower toupper totitle trim trimleft trimright wordend wordstart} - switch -- $pos { + switch -- ${pos} { 1 { return [CompleteFromList ${text} ${cmds}] } 2 { - switch -- $cmd { + switch -- ${cmd} { compare - equal { return [CompleteFromList ${text} { -nocase -length }] } @@ -3107,41 +3171,41 @@ wordend - wordstart { return [DisplayHints ] } } } 3 { - switch -- $cmd { + switch -- ${cmd} { compare - equal { - if {"-length" == $prev} { + if {"-length" == ${prev}} { return [DisplayHints ] } return [CompleteFromList ${text} \ - [RemoveUsedOptions $line {-nocase -length }]] + [RemoveUsedOptions ${line} {-nocase -length }]] } first - last { return [DisplayHints ] } map { - if {"-nocase" == $prev} { + if {"-nocase" == ${prev}} { return [DisplayHints ] } else { return [DisplayHints ] } } match { - if {"-nocase" == $prev} { + if {"-nocase" == ${prev}} { return [DisplayHints ] } else { return [DisplayHints ] } } is { return [CompleteFromList ${text} \ - [RemoveUsedOptions $line {-strict -failindex }]] + [RemoveUsedOptions ${line} {-strict -failindex }]] } bytelength {} index - wordend - @@ -3156,14 +3220,14 @@ trimleft - trimright { return [DisplayHints ?chars?] } } } 4 { - switch -- $cmd { + switch -- ${cmd} { compare - equal { - if {"-length" == $prev} { + if {"-length" == ${prev}} { return [DisplayHints ] } return [CompleteFromList ${text} \ [RemoveUsedOptions $line {-nocase -length }]] } @@ -3173,11 +3237,11 @@ map - match { return [DisplayHints ] } is { - if {"-failindex" == $prev} { + if {"-failindex" == ${prev}} { return [VarCompletion ${text}] } return [CompleteFromList ${text} \ [RemoveUsedOptions $line {-strict -failindex }]] } @@ -3197,26 +3261,26 @@ wordend - wordstart {} } } default { - switch -- $cmd { + switch -- ${cmd} { compare - equal { - if {"-length" == $prev} { + if {"-length" == ${prev}} { return [DisplayHints ] } return [CompleteFromList ${text} \ [RemoveUsedOptions $line {-nocase -length }]] } is { - if {"-failindex" == $prev} { + if {"-failindex" == ${prev}} { return [VarCompletion ${text}] } return [CompleteFromList ${text} \ - [RemoveUsedOptions $line {-strict -failindex }]] + [RemoveUsedOptions ${line} {-strict -failindex }]] } replace { return [DisplayHints ?newString?] } } } @@ -3223,31 +3287,31 @@ } return "" } proc complete(subst) {text start end line pos mod} { - return [CompleteFromList ${text} [RemoveUsedOptions $line { + return [CompleteFromList ${text} [RemoveUsedOptions ${line} { -nobackslashes -nocommands -novariables }]] } proc complete(switch) {text start end line pos mod} { set prev [PreviousWord ${start} ${line}] - if {[llength ${prev}] && "--" != $prev && \ - ("-" == [string index ${prev} 0] || 1 == $pos)} { + if {[llength ${prev}] && "--" != ${prev} && \ + ("-" == [string index ${prev} 0] || 1 == ${pos)}} { set cmds [RemoveUsedOptions ${line} { -exact -glob -regexp --} {--}] if {[llength ${cmds}]} { - return [string trim [CompleteFromList $text $cmds]] + return [string trim [CompleteFromList ${text} ${cmds}]] } } else { set virtual_pos [expr ${pos} - [FirstNonOption ${line}]] switch -- ${virtual_pos} { 0 { return [DisplayHints ] } 1 { return [DisplayHints ] } 2 { return [DisplayHints ] } default { - switch [expr $virtual_pos % 2] { + switch [expr ${virtual_pos} % 2] { 0 { return [DisplayHints ?body?] } 1 { return [DisplayHints ?pattern?] } } } } @@ -3269,18 +3333,18 @@ ::tclreadline::CompleteBoolean } } proc tclreadline::complete(readline) {text start end line pos mod} { - set cmd [Lindex $line 1] - switch -- $pos { + set cmd [Lindex ${line} 1] + switch -- ${pos} { 1 { return [CompleteFromList ${text} { read initialize write add complete customcompleter builtincompleter eofchar reset-terminal}] } 2 { - switch -- $cmd { + switch -- ${cmd} { read {} initialize {} write {} add { return [DisplayHints ] } completer { return [DisplayHints ] } @@ -3301,56 +3365,59 @@ } # --- END OF TCLREADLINE PACKAGE --- proc complete(tell) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return [ChannelId ${text}] } } return "" } proc complete(time) {text start end line pos mod} { - switch -- $pos { - 1 { return [BraceOrCommand $text $start $end $line $pos $mod] } + switch -- ${pos} { + 1 { return [BraceOrCommand \ + ${text} ${start} ${end} ${line} ${pos} ${mod}] + } 2 { return [DisplayHints ?count?] } } return "" } proc complete(trace) {text start end line pos mod} { set cmd [Lindex ${line} 1] - switch -- $pos { + switch -- ${pos} { 1 { return [CompleteFromList ${mod} {variable vdelete vinfo}] } 2 { return [CompleteFromList ${text} \ [uplevel [info level] info vars "${mod}*"]] } 3 { - switch -- $cmd { + switch -- ${cmd} { variable - vdelete { return [CompleteFromList ${text} {r w u}] } } } 4 { - switch -- $cmd { + switch -- ${cmd} { variable - vdelete { - return [CompleteFromList $text [CommandCompletion $text]] + return [CompleteFromList ${text} \ + [CommandCompletion ${text}]] } } } } return "" } proc complete(unknown) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { - return [CompleteFromList $text [CommandCompletion $text]] + return [CompleteFromList ${text} [CommandCompletion ${text}]] } default { return [DisplayHints ?arg?] } } return "" } @@ -3358,25 +3425,26 @@ proc complete(unset) {text start end line pos mod} { return [VarCompletion ${text}] } proc complete(update) {text start end line pos mod} { - switch -- $pos { + switch -- ${pos} { 1 { return idletasks } } return "" } proc complete(uplevel) {text start end line pos mod} { set one [Lindex ${line} 1] - switch -- $pos { + switch -- ${pos} { 1 { - return [CompleteFromList $text "?level? [CommandCompletion $text]"] + return [CompleteFromList \ + ${text} "?level? [CommandCompletion ${text}]"] } 2 { - if {"#" == [string index $one 0] || [regexp {^[0-9]*$} $one]} { - return [CompleteFromList $text [CommandCompletion $text]] + if {"#" == [string index ${one} 0] || [regexp {^[0-9]*$} ${one}]} { + return [CompleteFromList ${text} [CommandCompletion ${text}]] } else { return [DisplayHints ?arg?] } } default { return [DisplayHints ?arg?] } @@ -3508,13 +3576,18 @@ proc EventuallyInsertLeadingDot {text fallback} { if {![string length ${text}]} { return [list . {}] } else { - return [DisplayHints $fallback] + return [DisplayHints ${fallback}] } } + +# TODO +proc CompleteColor text { + return [DisplayHints ] +} #** # SpecificSwitchCompleter # --- # @param text -- the word to complete. @@ -3527,28 +3600,128 @@ # proc SpecificSwitchCompleter {text start line switch} { # TODO: # go to the `options' man page and look for possible values switch -- ${switch} { - -takefocus - - -exportselection { return [CompleteBoolean ${text}] } - -xscrollcommand - - -yscrollcommand { - # return [BraceOrCommand ${text} \ - # ${start} ${end} ${line} ${pos} ${mod}] + + -activebackground - + -activeforeground - + -fg - + -foreground - + -bg - + -background - + -disabledforeground - + -highlightbackground - + -highlightcolor - + -insertbackground - + -troughcolor - + -selectbackground - + -selectforeground { return [CompleteColor ${text}] } + + -activeborderwidth - + -bd - + -borderwidth - + -insertborderwidth - + -insertwidth - + -selectborderwidth - + -highlightthickness - + -padx - + -pady - + -wraplength { + return [DisplayHints ] + } + + -anchor { + return [CompleteFromList ${text} { + n ne e se s sw w nw center + }] + } + + + -bitmap { return [CompleteFromBitmaps ${text}] } + + + -cursor { return [DisplayHints ] } + -exportselection - + -jump - + -setgrid - + -takefocus { return [CompleteBoolean ${text}] } + -font { + set names [font names] + if {[string length ${names}]} { + return [CompleteFromList ${text} ${names}] + } else { + return [DisplayHints ] + } + } + + + -image - + -selectimage { + set images [image names] + if {[string length ${images}]} { + return [CompleteFromList ${text} ${images}] + } else { + return [DisplayHints ] + } + } + + -insertofftime - + -insertontime - + -repeatdelay - + -repeatinterval { return [DisplayHints ] } + -justify { + return [CompleteFromList ${text} { + left center right + }] + } + -orient { + return [CompleteFromList ${text} { + vertical horizontal + }] } -relief { return [CompleteFromList ${text} { raised sunken flat ridge solid groove }] } + + -text { return [DisplayHints ] } + -textvariable { return [VarCompletion ${text} #0] } + -underline { return [DisplayHints ] } + +-xscrollcommand - +-yscrollcommand { +} + + # WIDGET SPECIFIC OPTIONS + # --- + + -state { + return [CompleteFromList ${text} { + normal active disabled + }] + } + + -columnbreak - + -hidemargin - + -indicatoron { + return [CompleteBoolean ${text}] + } + + -variable { + return [VarCompletion ${text} #0] + } + default { set prev [PreviousWord ${start} ${line}] return [DisplayHints <[String range ${prev} 1 end]>] } } } + # return [BraceOrCommand ${text} \ + # ${start} ${line} ${pos} ${mod}] #** # CompleteWidgetConfigurations # --- # @param text -- the word to complete. @@ -3618,12 +3791,11 @@ } return [CompleteFromList ${text} \ [concat ${toplevels} ${widgets} ${toplevelClass} $rest]] } 2 { - set fulltext [Lindex $line 2] - return [CompleteSequence ${text} ${fulltext}] + return [CompleteSequence ${text} [Lindex ${line} 2]] } default { # return [DisplayHints {