Diff
Not logged in

Differences From Artifact [f9084f3db9]:

To Artifact [66fd51af9c]:


1
2
3
4
5
6
7
8
9
10
# -*- tclsh -*-
# FILE: "/disk01/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
# LAST MODIFICATION: "Thu Sep 16 02:53:18 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#


|







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)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
	} else {

		# try to use $pos further ...
		# puts stderr |$line|
		#
		if {"." == [string index [string trim ${line}] 0]} {
			set alias WIDGET
			set namespc ""
		} else {

			# the double `lindex' strips {} or quotes.
			# the subst enables variables containing
			# command names.
			#
			set alias [uplevel [info level] \







|







980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
	} else {

		# try to use $pos further ...
		# puts stderr |$line|
		#
		if {"." == [string index [string trim ${line}] 0]} {
			set alias WIDGET
			set namespc ""; # widgets are always in the global
		} else {

			# the double `lindex' strips {} or quotes.
			# the subst enables variables containing
			# command names.
			#
			set alias [uplevel [info level] \
1035
1036
1037
1038
1039
1040
1041



1042

1043
1044
1045
1046
1047
1048
1049
					[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}|



				return ${script_result}

			}
			# set namespc ""; # no qualifiers for tclreadline_complete_unknown
		}

		# as we've reached here no valid specific completer
		# was found. Check, if it's a proc and return the
		# arguments.







>
>
>
|
>







1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
					[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}] || \
					"tclreadline_complete_unknown" == ${cmd}
				} {
					return ${script_result}
				}
			}
			# set namespc ""; # no qualifiers for tclreadline_complete_unknown
		}

		# as we've reached here no valid specific completer
		# was found. Check, if it's a proc and return the
		# arguments.
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
	}
	return ""
}

proc complete(lappend) {text start end line pos mod} {
	switch -- $pos {
		1 { return [VarCompletion ${text}] }
		default { return [DisplayHints ?value?] }
	}
	return ""
}

# the following routines are described in the
# `library' man page.
# --- LIBRARY ---







|







2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
	}
	return ""
}

proc complete(lappend) {text start end line pos mod} {
	switch -- $pos {
		1 { return [VarCompletion ${text}] }
		default { return [TryFromList ${text} ?value?] }
	}
	return ""
}

# the following routines are described in the
# `library' man page.
# --- LIBRARY ---
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990







2991
2992
2993
2994
2995
2996
2997
}

proc tclreadline::complete(readline) {text start end line pos mod} {
	set cmd [Lindex $line 1]
	switch -- $pos {
		1 { return [CompleteFromList ${text} {
			read initialize write add complete
			customcompleter builtincompleter eofchar}]
		}
		2 {
			switch -- $cmd {
				read {}
				initialize {}
				write {}
				add { return [DisplayHints <completerLine>] }
				completer { return [DisplayHints <line>] }
				customcompleter { return [DisplayHints ?scriptCompleter?] }
				builtincompleter { return [DisplayHints ?boolean?] }
				eofchar { return [DisplayHints ?script?] }







			}
		}
	}
	return ""
}

# --- END OF TCLREADLINE PACKAGE ---







|











>
>
>
>
>
>
>







2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
}

proc tclreadline::complete(readline) {text start end line pos mod} {
	set cmd [Lindex $line 1]
	switch -- $pos {
		1 { return [CompleteFromList ${text} {
			read initialize write add complete
			customcompleter builtincompleter eofchar reset-terminal}]
		}
		2 {
			switch -- $cmd {
				read {}
				initialize {}
				write {}
				add { return [DisplayHints <completerLine>] }
				completer { return [DisplayHints <line>] }
				customcompleter { return [DisplayHints ?scriptCompleter?] }
				builtincompleter { return [DisplayHints ?boolean?] }
				eofchar { return [DisplayHints ?script?] }
				reset-terminal {
					if {[info exists ::env(TERM)]} {
						return [CompleteFromList ${text} $::env(TERM)]
					} else {
						return [DisplayHints ?terminalName?]
					}
				}
			}
		}
	}
	return ""
}

# --- END OF TCLREADLINE PACKAGE ---