Diff
Not logged in

Differences From Artifact [66fd51af9c]:

To Artifact [cb20dd6778]:


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: "Thu Sep 16 16:24:46 1999 (joze)"
# FILE: "/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
# LAST MODIFICATION: "Thu Sep 16 22:17:38 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
1005
1006
1007
1008
1009
1010
1011



1012
1013
1014
1015
1016
1017
1018
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021







+
+
+







			# strip leading ::'s.
			#
			regsub -all {^::} $alias {} alias
			set namespc [namespace qualifiers $alias]
			set alias [namespace tail $alias]
		}

		# try first a specific completer, then, and only then
		# the tclreadline_complete_unknown.
		#
		foreach cmd [list ${alias} tclreadline_complete_unknown] {
			# puts stderr ${namespc}complete(${cmd})
			if {"" != [namespace eval ::tclreadline::${namespc} \
				[list info procs complete(${cmd})]]
			} {
				# puts found=|complete($cmd)|
				# to be more error-proof, we check here,
1035
1036
1037
1038
1039
1040
1041
1042

1043
1044








1045
1046
1047
1048
1049
1050
1051
1038
1039
1040
1041
1042
1043
1044

1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062







-
+


+
+
+
+
+
+
+
+







					[namespace eval ::tclreadline::${namespc} \
					[list complete(${cmd}) $part $start $end $line $pos $mod]]]\
					::tclreadline::errorMsg]
				} {
					error [list error during evaluation of `complete(${cmd})']
				}
				# puts stderr \nscript_result=|${script_result}|
				if {[string length ${script_result}] || \
				if {![string length ${script_result}] && \
					"tclreadline_complete_unknown" == ${cmd}
				} {
					# as we're here, the tclreadline_complete_unknown
					# returned an empty string. Fall thru and try
					# further fallback completers.
					#
				} else {
					# return also empty strings, if
					# they're from a specific completer.
					#
					return ${script_result}
				}
			}
			# set namespc ""; # no qualifiers for tclreadline_complete_unknown
		}

		# as we've reached here no valid specific completer
3012
3013
3014
3015
3016
3017
3018
3019

3020
3021
3022
3023
3024
3025
3026
3023
3024
3025
3026
3027
3028
3029

3030
3031
3032
3033
3034
3035
3036
3037







-
+







		1 { return [ChannelId ${text}] }
	}
	return ""
}

proc complete(time) {text start end line pos mod} {
	switch -- $pos {
		1 { return [DisplayHints <script>] }
		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]