1
2
3
4
5
6
7
8
9
10
|
1
2
3
4
5
6
7
8
9
10
|
-
-
+
+
|
# -*- tclsh -*-
# FILE: "/disk01/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
# LAST MODIFICATION: "Wed Sep 29 18:00:58 1999 (joze)"
# FILE: "/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
# LAST MODIFICATION: "Wed Sep 29 21:25:15 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999 Johannes Zellner
#
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
-
+
|
# CompleteFromList will never return an empty string.
# 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 {allow ""} {inhibit 0}} {
set result [TryFromList ${text} ${lst} ${allow} $inhibit]
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}"]
} else {
return [string trim [list ${text} {}]]
|
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
|
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
|
-
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
|
2 {
return [CompleteFromList ${text} \
[uplevel [info level] info vars "${mod}*"]]
}
3 {
switch -- ${cmd} {
variable -
vdelete { return [CompleteFromList ${text} {r w u}] }
variable { return [CompleteFromList ${text} {r w u}] }
vdelete {
set var [PreviousWord ${start} ${line}]
set modes ""
foreach info [uplevel [info level] trace vinfo ${var}] {
lappend modes [lindex ${info} 0]
}
return [CompleteFromList ${text} ${modes}]
}
}
}
4 {
switch -- ${cmd} {
variable -
variable {
vdelete {
return [CompleteFromList ${text} \
[CommandCompletion ${text}]]
}
vdelete {
set var [Lindex ${line} 2]
set mode [PreviousWord ${start} ${line}]
set scripts ""
foreach info [uplevel [info level] trace vinfo ${var}] {
if {${mode} == [lindex ${info} 0]} {
lappend scripts [list [lindex ${info} 1]]
}
}
return [DisplayHints ${scripts}]
}
}
}
}
return ""
}
proc complete(unknown) {text start end line pos mod} {
|