Check-in [f06e7a16c7]
Not logged in
Overview
Comment: share/vim/ft/tcl_ft.vim src/tclreadline/tclreadlineCompleter.tcl
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f06e7a16c7a85fcef2982390345e0670001a12ba
User & Date: johannes@zellner.org on 1999-09-19 10:48:54
Other Links: manifest | tags
Context
1999-09-19
21:18
share/vim/functions/tcleval.vim src/tclreadline/README src/tclreadline/configure.in src/tclreadline/tclreadline.c src/tclreadline/tclreadline.n.in src/tclreadline/tclreadlineCompleter.tcl src/tclreadline/tclreadlineSetup.tcl.in check-in: a7cb82dbde user: johannes@zellner.org tags: trunk
10:48
share/vim/ft/tcl_ft.vim src/tclreadline/tclreadlineCompleter.tcl check-in: f06e7a16c7 user: johannes@zellner.org tags: trunk
1999-09-18
02:31
src/tclreadline/tclreadline.c src/tclreadline/tclreadlineCompleter.tcl check-in: 7e22ff2cc0 user: johannes@zellner.org tags: trunk
Changes

Modified tclreadlineCompleter.tcl from [e0fb9f8efc] to [d353429a4a].

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







# -*- 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, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58







-
+








namespace eval tclreadline {

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

# set tclreadline::trace_procs to 1, if you
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154



155
156
157
158
159
160
161
140
141
142
143
144
145
146

147
148
149
150
151
152
153

154
155
156
157
158
159
160
161
162
163







-
+






-
+
+
+







# a space after a complete (single) match.
#
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} {
			return [list $completion {}]
		} else {
178
179
180
181
182
183
184
185
186


187
188
189
190
191
192
193
180
181
182
183
184
185
186


187
188
189
190
191
192
193
194
195







-
-
+
+







#**
# 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 {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}"]
		} else {
			return [string trim [list ${text} {}]]
391
392
393
394
395
396
397



























398
399
400
401
402
403
404
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







		}
		if {"" == ${str}} {
			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.
# @param optionsT where the table will be stored.
# @return number of options
533
534
535
536
537
538
539
540

541
542
543
544
545
546
547
562
563
564
565
566
567
568

569
570
571
572
573
574
575
576







-
+







	if {![string length ${fullpart}]} {

		# 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}]]
		for {set i 0} {${i} < ${diff}} {incr i} {
			append text ${post}
565
566
567
568
569
570
571
572

573
574
575
576
577
578
579
594
595
596
597
598
599
600

601
602
603
604
605
606
607
608







-
+







	# TODO this is awkward. Think of making it better!
	#
	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}]} {
		return [list ${left}]${completion}
	} else {
683
684
685
686
687
688
689




690
691
692
693
694
695
696
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729







+
+
+
+







proc IsWhite {char} {
	if {" " == $char || "\n" == $char || "\t" == $char} {
		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} {
		set c [string index $line $i]
		if {${found} && [IsWhite $c]} {
896
897
898
899
900
901
902




903
904
905
906
907
908
909
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946







+
+
+
+







	# puts stderr \nline=$line
	return $len
}

#**
# 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 -
			index {
				if {"end" == [lindex $args end]} {
923
924
925
926
927
928
929

930
931
932
933





934
935
936
937
938
939
940
960
961
962
963
964
965
966
967




968
969
970
971
972
973
974
975
976
977
978
979







+
-
-
-
-
+
+
+
+
+







		return [String range $text 1 end]
	} else {
		return $text
	}
}

proc VarCompletion {text {level -1}} {
	if {"#" != [string index ${level} 0]} {
	if {-1 == ${level}} {
		set level [info level]
	} else {
		incr level
		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|"

	# arrays
2660
2661
2662
2663
2664
2665
2666
2667

2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684

2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701


2702
2703
2704
2705

2706
2707
2708
2709
2710
2711
2712


2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724


2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741

2742
2743
2744
2745
2746
2747
2748

2749
2750

2751
2752

2753
2754
2755
2756
2757
2758
2759

2760
2761
2762
2763
2764
2765

2766
2767
2768
2769
2770
2771
2772
2773

2774
2775
2776
2777


2778
2779
2780
2781
2782
2783
2784
2699
2700
2701
2702
2703
2704
2705

2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722

2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738


2739
2740
2741
2742
2743

2744
2745
2746
2747
2748
2749


2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761


2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779

2780
2781
2782
2783
2784
2785
2786

2787
2788

2789
2790

2791
2792
2793
2794
2795
2796
2797

2798
2799
2800
2801
2802
2803

2804
2805
2806
2807
2808
2809
2810
2811

2812
2813
2814
2815

2816
2817
2818
2819
2820
2821
2822
2823
2824







-
+
















-
+















-
-
+
+



-
+





-
-
+
+










-
-
+
+
















-
+






-
+

-
+

-
+






-
+





-
+







-
+



-
+
+








proc complete(open) {text start end line pos mod} {
		# 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 ""
}

proc complete(package) {text start end line pos mod} {
	set cmd [Lindex $line 1]
	switch -- $pos {
		1 {
			set cmds {
				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 -
				require {
					return [CompleteFromList ${mod} "-exact [package names]"] }
				names {}
				unknown { return [DisplayHints ?command?] }
				vcompare -
				vsatisfies { return [DisplayHints <version1>] }
			}
		}
		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 <version>]
					}
				}
				provide {
					if {"" != $versions} {
						return [CompleteFromList ${text} $versions]
					if {"" != ${versions}} {
						return [CompleteFromList ${text} ${versions}]
					} else {
						return [DisplayHints ?version?]
					}
				}
				versions {}
				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?]
						}
					}
				}
				names {}
				unknown {}
				vcompare -
				vsatisfies { return [DisplayHints <version2>] }
			}
		}
	}
	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 -- <dir>} {--}]
	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 <pkgPat>]
	} elseif {"--" == $prev} {
	} elseif {"--" == ${prev}} {
		return [TryFromList ${text} <dir>]
	}
	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 <args>]
			} else {
				return [list "\{${args}\}"]
			}
		}
		3 {
			if {![string length [Lindex $line $pos]]} {
			if {![string length [Lindex ${line} ${pos}]]} {
				return [list \{ {}]; # \}
			} else {
				# return [DisplayHints <body>]
				return [BraceOrCommand $text $start $end $line $pos $mod]
				return [BraceOrCommand \
				${text} ${start} ${end} ${line} ${pos} ${mod}]
			}
		}
	}
	return ""
}

proc complete(puts) {text start end line pos mod} {
2825
2826
2827
2828
2829
2830
2831
2832

2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852

2853
2854
2855
2856

2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873

2874
2875
2876
2877
2878
2879
2880
2865
2866
2867
2868
2869
2870
2871

2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891

2892
2893
2894
2895

2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912

2913
2914
2915
2916
2917
2918
2919
2920







-
+



















-
+



-
+
















-
+







	set prev [PreviousWord ${start} ${line}]
	if {[llength ${prev}] && "--" != $prev && \
		("-" == [string index ${prev} 0] || 1 == $pos)} {
		set cmds [RemoveUsedOptions ${line} {
			-nocase -indices -expanded -line 
			-linestop -lineanchor -about <expression> --} {--}]
		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 <string>] }
			1 { return [DisplayHints ?matchVar?] }
			default { return [DisplayHints ?subMatchVar?] }
		}
	}
	return ""
}

# proc complete(regexp) {text start end line pos mod} {
#     We're not on windoze here ...
# }

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 <expression>] }
			1 { return [DisplayHints <string>] }
			2 { return [DisplayHints <subSpec>] }
			3 { return [DisplayHints <varName>] }
		}
	}
	return ""
}

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 <newName>]
		}
	}
	return ""
}
2906
2907
2908
2909
2910
2911
2912
2913


2914
2915
2916
2917
2918
2919
2920
2946
2947
2948
2949
2950
2951
2952

2953
2954
2955
2956
2957
2958
2959
2960
2961







-
+
+







namespace eval safe {
	catch {
		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
	}
	proc SlaveOrOpts {text start line pos slave} {
		set prev [PreviousWord ${start} ${line}]
2932
2933
2934
2935
2936
2937
2938
2939

2940
2941
2942
2943

2944
2945
2946
2947
2948
2949
2950
2951

2952
2953
2954
2955
2956


2957
2958
2959
2960
2961
2962


2963
2964
2965
2966
2967

2968
2969
2970
2971





















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

2998
2999
3000

3001
3002
3003
3004

3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018

3019
3020
3021

3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039

3040
3041
3042
3043


3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054





3055
3056

3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069

3070
3071
3072
3073
3074

3075
3076
3077
3078
3079
3080
3081
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
2998
2999
3000
3001


3002
3003
3004
3005
3006
3007

3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037

3038
3039
3040
3041
3042
3043
3044
3045
3046

3047
3048
3049
3050
3051
3052
3053
3054
3055

3056
3057
3058

3059
3060
3061

3062
3063
3064
3065

3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079

3080
3081
3082

3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100

3101
3102
3103


3104
3105
3106
3107
3108
3109
3110
3111
3112
3113



3114
3115
3116
3117
3118
3119

3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132

3133
3134
3135
3136
3137

3138
3139
3140
3141
3142
3143
3144
3145







-
+



-
+







-
+



-
-
+
+




-
-
+
+




-
+




+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+




-
+








-
+








-
+


-
+


-
+



-
+













-
+


-
+

















-
+


-
-
+
+








-
-
-
+
+
+
+
+

-
+












-
+




-
+







				[RemoveUsedOptions ${line} "${opts} $slave"]]
			}
		}
	}
}

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 <slave>] }
		default {
			switch -- [PreviousWord ${start} ${line}] {
				-use {
					return [CompleteFromList ${text} \
					[::tclreadline::WidgetChildren ${text}]]
				}
				-display {
					return [DisplayHints <display>]
				}
				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 <string>] }
		2 { return [DisplayHints <format>] }
		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 <offset>] }
		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 ""
}

proc complete(socket) {text start end line pos mod} {
	set cmd [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	if {"-server" == ${cmd}} {
		# server sockets
		#
		switch -- $pos {
		switch -- ${pos} {
			2 { return [DisplayHints <command>] }
			default {
				if {"-myaddr" == $prev} {
				if {"-myaddr" == ${prev}} {
					return [DisplayHints <addr>]
				} else {
					return [CompleteFromList ${mod} \
					[RemoveUsedOptions $line {-myaddr -error -sockname <port>}]]
				}
			}
		}
	} else {
		# client sockets
		#
		switch -- ${prev} {
			-myaddr { return [DisplayHints <addr>] }
			-myport { return [DisplayHints <port>] }
		}

		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 <port>]
		} 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 <string>] }
		2 { return [DisplayHints ?splitChars?] }
	}
}

proc complete(string) {text start end line pos mod} {
	set cmd [Lindex ${line} 1]
	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 <string> }]
				}

				first -
3105
3106
3107
3108
3109
3110
3111
3112

3113
3114
3115

3116
3117
3118
3119

3120
3121
3122
3123
3124
3125
3126

3127
3128
3129
3130
3131
3132
3133

3134
3135
3136
3137
3138
3139
3140
3141
3142

3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161

3162
3163
3164

3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178

3179
3180
3181
3182
3183
3184
3185
3169
3170
3171
3172
3173
3174
3175

3176
3177
3178

3179
3180
3181
3182

3183
3184
3185
3186
3187
3188
3189

3190
3191
3192
3193
3194
3195
3196

3197
3198
3199
3200
3201
3202
3203
3204
3205

3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224

3225
3226
3227

3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241

3242
3243
3244
3245
3246
3247
3248
3249







-
+


-
+



-
+






-
+






-
+








-
+


















-
+


-
+













-
+







				trimleft -
				trimright -
				wordend -
				wordstart { return [DisplayHints <string>] }
			}
		}
		3 {
			switch -- $cmd {
			switch -- ${cmd} {
				compare -
				equal {
					if {"-length" == $prev} {
					if {"-length" == ${prev}} {
						return [DisplayHints <int>]
					}
					return [CompleteFromList ${text} \
					[RemoveUsedOptions $line {-nocase -length <string>}]]
					[RemoveUsedOptions ${line} {-nocase -length <string>}]]
				}

				first -
				last { return [DisplayHints <string2>] }

				map {
					if {"-nocase" == $prev} {
					if {"-nocase" == ${prev}} {
						return [DisplayHints <charMap>]
					} else {
						return [DisplayHints <string>]
					}
				}
				match {
					if {"-nocase" == $prev} {
					if {"-nocase" == ${prev}} {
						return [DisplayHints <pattern>]
					} else {
						return [DisplayHints <string>]
					}
				}

				is {
					return [CompleteFromList ${text} \
					[RemoveUsedOptions $line {-strict -failindex <string>}]]
					[RemoveUsedOptions ${line} {-strict -failindex <string>}]]
				}

				bytelength {}
				index -
				wordend -
				wordstart { return [DisplayHints <charIndex>] }
				range -
				replace { return [DisplayHints <first>] }
				repeat { return [DisplayHints <count>] }
				tolower -
				totitle -
				toupper { return [DisplayHints ?first?] }
				trim -
				trimleft -
				trimright { return [DisplayHints ?chars?] }
			}
		}
		4 {
			switch -- $cmd {
			switch -- ${cmd} {
				compare -
				equal {
					if {"-length" == $prev} {
					if {"-length" == ${prev}} {
						return [DisplayHints <int>]
					}
					return [CompleteFromList ${text} \
					[RemoveUsedOptions $line {-nocase -length <string>}]]
				}

				first -
				last { return [DisplayHints ?startIndex?] }

				map -
				match { return [DisplayHints <string>] }

				is {
					if {"-failindex" == $prev} {
					if {"-failindex" == ${prev}} {
						return [VarCompletion ${text}]
					}
					return [CompleteFromList ${text} \
					[RemoveUsedOptions $line {-strict -failindex <string>}]]
				}

				bytelength {}
3195
3196
3197
3198
3199
3200
3201
3202

3203
3204
3205

3206
3207
3208
3209
3210
3211
3212
3213

3214
3215
3216
3217

3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228

3229
3230
3231
3232
3233
3234
3235


3236
3237
3238
3239

3240
3241
3242
3243
3244
3245
3246
3247
3248

3249
3250
3251
3252
3253
3254
3255
3259
3260
3261
3262
3263
3264
3265

3266
3267
3268

3269
3270
3271
3272
3273
3274
3275
3276

3277
3278
3279
3280

3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291

3292
3293
3294
3295
3296
3297


3298
3299
3300
3301
3302

3303
3304
3305
3306
3307
3308
3309
3310
3311

3312
3313
3314
3315
3316
3317
3318
3319







-
+


-
+







-
+



-
+










-
+





-
-
+
+



-
+








-
+







				trimleft -
				trimright {}
				wordend -
				wordstart {}
			}
		}
		default {
			switch -- $cmd {
			switch -- ${cmd} {
				compare -
				equal {
					if {"-length" == $prev} {
					if {"-length" == ${prev}} {
						return [DisplayHints <int>]
					}
					return [CompleteFromList ${text} \
					[RemoveUsedOptions $line {-nocase -length <string>}]]
				}

				is {
					if {"-failindex" == $prev} {
					if {"-failindex" == ${prev}} {
						return [VarCompletion ${text}]
					}
					return [CompleteFromList ${text} \
					[RemoveUsedOptions $line {-strict -failindex <string>}]]
					[RemoveUsedOptions ${line} {-strict -failindex <string>}]]
				}

				replace { return [DisplayHints ?newString?] }
			}
		}
	}
	return ""
}

proc complete(subst) {text start end line pos mod} {
	return [CompleteFromList ${text} [RemoveUsedOptions $line {
	return [CompleteFromList ${text} [RemoveUsedOptions ${line} {
		-nobackslashes -nocommands -novariables <string>}]]
}

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 <string>] }
			1 { return [DisplayHints <pattern>] }
			2 { return [DisplayHints <body>] }
			default { 
				switch [expr $virtual_pos % 2] {
				switch [expr ${virtual_pos} % 2] {
					0 { return [DisplayHints ?body?] }
					1 { return [DisplayHints ?pattern?] }
				}
			}
		}
	}
	return ""
3267
3268
3269
3270
3271
3272
3273
3274
3275


3276
3277
3278
3279
3280
3281

3282
3283
3284
3285
3286
3287
3288
3331
3332
3333
3334
3335
3336
3337


3338
3339
3340
3341
3342
3343
3344

3345
3346
3347
3348
3349
3350
3351
3352







-
-
+
+





-
+







		::tclreadline::CompleteFromList \
		::tclreadline::Lindex \
		::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 <completerLine>] }
				completer { return [DisplayHints <line>] }
				customcompleter { return [DisplayHints ?scriptCompleter?] }
				builtincompleter { return [CompleteBoolean ${text}] }
3299
3300
3301
3302
3303
3304
3305
3306

3307
3308
3309
3310
3311
3312
3313
3314




3315
3316
3317
3318
3319
3320
3321
3322

3323
3324
3325
3326
3327
3328
3329
3330
3331

3332
3333
3334
3335
3336
3337

3338
3339
3340


3341
3342
3343
3344
3345
3346
3347
3348
3349

3350
3351

3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363

3364
3365
3366
3367
3368
3369
3370
3371

3372
3373


3374
3375
3376
3377


3378
3379
3380
3381
3382
3383
3384
3363
3364
3365
3366
3367
3368
3369

3370
3371
3372
3373
3374
3375
3376


3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387

3388
3389
3390
3391
3392
3393
3394
3395
3396

3397
3398
3399
3400
3401
3402

3403
3404
3405

3406
3407
3408
3409
3410
3411
3412
3413
3414
3415

3416
3417

3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429

3430
3431
3432
3433
3434
3435
3436
3437

3438
3439

3440
3441
3442
3443


3444
3445
3446
3447
3448
3449
3450
3451
3452







-
+






-
-
+
+
+
+







-
+








-
+





-
+


-
+
+








-
+

-
+











-
+







-
+

-
+
+


-
-
+
+







	}
	return ""
}

# --- 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 ""
}

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?] }
	}
	return ""
3506
3507
3508
3509
3510
3511
3512
3513

3514
3515





3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537












































































3538
3539
3540
3541
3542
3543




























3544
3545
3546
3547
3548
3549


3550
3551
3552
3553
3554
3555
3556
3574
3575
3576
3577
3578
3579
3580

3581
3582
3583
3584
3585
3586
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
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729







-
+


+
+
+
+
+
















-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+






+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+






+
+







# 	return [CompleteFromOptionsOrSubCmds ${text} ${start} ${end} ${line} ${pos}]
# }

proc EventuallyInsertLeadingDot {text fallback} {
	if {![string length ${text}]} {
		return [list . {}]
	} else {
		return [DisplayHints $fallback]
		return [DisplayHints ${fallback}]
	}
}

# TODO
proc CompleteColor text {
	return [DisplayHints <color>]
}

#**
# SpecificSwitchCompleter
# ---
# @param    text   -- the word to complete.
# @param    start  -- the char index of text's start in line
# @param    line   -- the line gathered so far.
# @param    switch -- the switch to complete for.
# @return   a std tclreadline formatted completer string.
# @sa       CompleteWidgetConfigurations
# @date     Sep-17-1999
#
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 <pixels>]
		}

		-anchor {
			return [CompleteFromList ${text} {
				n ne e se s sw w nw center
			}]
		}


		-bitmap { return [CompleteFromBitmaps ${text}] }


		-cursor { return [DisplayHints <cursor>] }
		-exportselection -
		-jump -
		-setgrid -
		-takefocus { return [CompleteBoolean ${text}] }
		-font {
			set names [font names]
			if {[string length ${names}]} {
				return [CompleteFromList ${text} ${names}]
			} else {
				return [DisplayHints <font>]
			}
		}


		-image -
		-selectimage {
			set images [image names]
			if {[string length ${images}]} {
				return [CompleteFromList ${text} ${images}]
			} else {
				return [DisplayHints <image>]
			}
		}

		-insertofftime -
		-insertontime -
		-repeatdelay -
		-repeatinterval { return [DisplayHints <milliSec>] }
		-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 <text>] }
		-textvariable { return [VarCompletion ${text} #0] }
		-underline { return [DisplayHints <index>] }

-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.
# @param    start -- the actual cursor position.
# @param    line  -- the line gathered so far.
3616
3617
3618
3619
3620
3621
3622
3623
3624

3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643

3644
3645
3646
3647
3648
3649
3650
3789
3790
3791
3792
3793
3794
3795


3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814

3815
3816
3817
3818
3819
3820
3821
3822







-
-
+


















-
+







				Scale Scrollbar Text
				all
			}
			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 {<script> <+script>}]
			return [BraceOrCommand ${text} \
			${start} ${end} ${line} ${pos} ${mod}]
		}
	}
	return ""
}

proc complete(bindtags) {text start end line pos mod} {
	switch -- ${pos} {
		1 { return [CompleteFromList ${text} [WidgetChildren ${text}]] }
		2 {
			# set current_tags \
			# [RemoveUsedOptions ${line} [bindtags [Lindex ${line} 1]]]
			set current_tags [bindtags [Lindex ${line} 1]]
			return [CompleteListFromList ${text} [Lindex ${line} 2] \
			$current_tags \{ { } \}]
			${current_tags} \{ { } \}]
		}
	}
	return ""
}

proc complete(button) {text start end line pos mod} {
	switch -- ${pos} {
3765
3766
3767
3768
3769
3770
3771

































































































































































































































































































































3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782











































































































































































3783
3784
3785
3786
3787
3788
3789
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+











+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







				-takefocus -textvariable -xscrollcommand -show -state
				-width
			}]
		}
	}
	return ""
}

proc complete(event) {text start end line pos mod} {
	set sub [Lindex ${line} 1]
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} { add delete generate info }]
		}
		2 {
			switch -- ${sub} {
				add { return [DisplayHints <<virtual>>] }
				info -
				delete {
					return [CompleteFromList ${text} [event info] "<"]
				}
				generate {
					return [TryFromList ${text} [WidgetChildren ${text}]]
				}
			}
		}
		3 {
			switch -- ${sub} {
				add -
				delete -
				generate {
					return [CompleteSequence ${text} [Lindex ${line} 3]]
				}
				info {}
			}
		}
		default {
			switch -- ${sub} {
				add -
				delete {
					return [CompleteSequence ${text} [Lindex ${line} 3]]
				}
				info {}
				generate {

					switch -- [PreviousWord ${start} ${line}] {

						-above -
						-root -
						-subwindow {
							return [TryFromList ${text} \
							[WidgetChildren ${text}]]
						}

						-borderwidth { return [DisplayHints <size>] }

						-button -
						-delta -
						-keycode -
						-serial -
						-count { return [DisplayHints <number>] }

						-detail {
							return [CompleteFromList ${text} { 
								NotifyAncestor    NotifyNonlinearVirtual
								NotifyDetailNone  NotifyPointer
								NotifyInferior    NotifyPointerRoot
								NotifyNonlinear   NotifyVirtual
							}]
						}

						-focus -
						-override -
						-sendevent { return [CompleteBoolean ${text}] }

						-height -
						-width { return [DisplayHints <size>] }

						-keysym { return [DisplayHints <name>] }

						-mode {
							return [CompleteFromList ${text} { 
								NotifyNormal NotifyGrab
								NotifyUngrab NotifyWhileGrabbed
							}]
						}

						-place {
							return [CompleteFromList ${text} { 
								PlaceOnTop PlaceOnBottom
							}]
						}

						-rootx -
						-rooty -
						-x -
						-y { return [DisplayHints <coord>] }

						-state {
							return [CompleteFromList ${text} { 
								VisibilityUnobscured
								VisibilityPartiallyObscured
								VisibilityFullyObscured
								<integer>
							}]
						}

						-time { return [DisplayHints <integer>] }
						-when {
							return [CompleteFromList ${text} { 
								now tail head mark
							}]
						}

						default {
							return [CompleteFromList ${text} \
							[RemoveUsedOptions ${line} {
								-above -borderwidth -button -count -delta
								-detail -focus -height -keycode -keysym
								-mode -override -place -root -rootx -rooty
								-sendevent -serial -state -subwindow -time
								-width -when -x -y
							}]]

						}
					}
					default { }
				}
			}
		}
	}
	return ""
}

proc complete(focus) {text start end line pos mod} {
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} \
			[concat [WidgetChildren ${text}] -displayof -force -lastfor]]
		}
		default {
			switch -- [PreviousWord ${start} ${line}] {
				-displayof -
				-force -
				-lastfor {
					return [CompleteFromList ${text} \
					[WidgetChildren ${text}]]
				}
			}
		}
	}
	return ""
}

proc FontConfigure {text line prev} {
	set fontopts {-family -overstrike -size -slant -underline -weight}
	switch -- ${prev} {
		-family {
			return [CompleteFromList ${text} [font families]]
		}
		-underline -
		-overstrike { return [CompleteBoolean ${text}] }
		-size { return [DisplayHints <size>] }
		-slant {
			return [CompleteFromList ${text} { roman italic }]
		}
		-weight {
			return [CompleteFromList ${text} { normal bold }]
		}
		default {
			return [CompleteFromList ${text} \
			[RemoveUsedOptions ${line} ${fontopts}]]
		}
	}
}

proc complete(font) {text start end line pos mod} {
	set fontopts {-family -overstrike -size -slant -underline -weight}
	set fontmetrics {-ascent -descent -linespace -fixed}
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} {
				actual configure create delete families measure metrics names
			}]
		}
		2 {
			switch -- ${sub} {
				actual -
				measure -
				metrics {
					return [DisplayHints <font>]
				}
				configure -
				delete {
					set names [font names]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <fontname>]
					}
				}
				create {
					return [CompleteFromList ${text} \
					[concat ?fontname? ${fontopts}]]
				}
				families {
					return [CompleteFromList ${text} -displayof]
				}
				names {}
			}
		}
		3 {
			switch -- ${sub} {
				actual {
					return [CompleteFromList ${text} \
					[concat -displayof ${fontopts}]]
				}
				configure -
				create {
					return [FontConfigure ${text} ${line} ${prev}]
				}
				delete {
					set names [font names]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <fontname>]
					}
				}
				families {
					switch -- ${prev} {
						-displayof {
							return [CompleteFromList ${text} \
							[WidgetChildren ${text}]]
						}
					}
				}
				measure {
					return [CompleteFromList ${text} {-displayof <text>}]
				}
				metrics {
					return [CompleteFromList ${text} \
					[concat -displayof ${fontmetrics}]]
				}
				names {}
			}
		}
		4 {
			switch -- ${sub} {
				actual {
					switch -- ${prev} {
						-displayof {
							return [CompleteFromList ${text} \
							[WidgetChildren ${text}]]
						}
						default {
							return [FontConfigure ${text} ${line} ${prev}]
						}
					}
				}
				configure -
				create {
					return [FontConfigure ${text} ${line} ${prev}]
				}
				delete {
					set names [font names]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <fontname>]
					}
				}
				families {}
				measure {
					switch -- ${prev} {
						-displayof {
							return [CompleteFromList ${text} \
							[WidgetChildren ${text}]]
						}
						default {
							return [DisplayHints <text>]
						}
					}
				}
				metrics {
					switch -- ${prev} {
						-displayof {
							return [CompleteFromList ${text} \
							[WidgetChildren ${text}]]
						}
						default {
							return [CompleteFromList ${text} ${fontmetrics}]
						}
					}
				}
				names {}
			}
		}
		default {
			switch -- ${sub} {
				actual -
				configure -
				create {
					return [FontConfigure ${text} ${line} ${prev}]
				}
				delete {
					set names [font names]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <fontname>]
					}
				}
				families {}
				measure {
					return [DisplayHints <text>]
				}
				metrics {
					return [CompleteFromList ${text} ${fontmetrics}]
				}
				names {}
			}
		}
	}
	return ""
}

proc complete(frame) {text start end line pos mod} {
	switch -- ${pos} {
		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
		default {
			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
				-borderwidth -cursor -highlightbackground -highlightcolor
				-highlightthickness -relief -takefocus -background
				-class -colormap -container -height -visual -width
			}]
		}
	}
	return ""
}

proc complete(grab) {text start end line pos mod} {
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} [concat \
			current release set status -global [WidgetChildren ${text}]]]
		}
		2 {
			switch -- [Lindex ${line} 1] {
				-global -
				current -
				release -
				status {
					return [CompleteFromList ${text} [WidgetChildren ${text}]]
				}
				set {
					return [CompleteFromList ${text} \
					[concat -global [WidgetChildren ${text}]]]
				}
			}
		}
		3 {
			switch -- [Lindex ${line} 1] {
				set {
					switch -- [PreviousWord ${start} ${line}] {
						-global {
							return [CompleteFromList ${text} \
							[WidgetChildren ${text}]]
						}
					}
				}
			}
		}
	}
	return ""
}

proc GridConfig {text start line prev} {
	set opts {
		-column -columnspan -in -ipadx -ipady
		-padx -pady -row -rowspan -sticky
	}
	if {-1 == [string first "-" ${line}]} {
		set slave [WidgetChildren ${text}]
	} else {
		set slave ""
	}
	switch -- ${prev} {
		-column -
		-columnspan -
		-row -
		-rowspan { return [DisplayHints <n>] }

		-ipadx -
		-ipady -
		-padx -
		-pady { return [DisplayHints <amount>] }

		-in { return [CompleteFromList ${text} [WidgetChildren ${text}]] }
		-sticky {
			set prev [PreviousWordOfIncompletePosition ${start} ${line}]
			return [CompleteListFromList ${text} \
			[string trimleft [IncompleteListRemainder ${line}]] \
			{n e s w} \{ { } \}]
		}


		default {
			return [CompleteFromList ${text} \
			[RemoveUsedOptions ${line} [concat ${opts} ${slave}]]]
		}
	}
}
 
proc complete(grid) {text start end line pos mod} {
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} \
			[concat [WidgetChildren ${text}] {
				bbox columnconfigure configure forget
				info location propagate rowconfigure
				remove size slaves
			}]]
		}
		2 {
			switch -- ${sub} {
				bbox -
				columnconfigure -
				configure -
				forget -
				info -
				location -
				propagate -
				rowconfigure -
				remove -
				size -
				slaves {
					return [CompleteFromList ${text} [WidgetChildren ${text}]]
				}
				default {
					return [GridConfig ${text} ${start} ${line} ${prev}]
				}
			}
		}
		default {
			switch -- ${sub} {
				bbox {
					switch [expr ${pos} % 2] {
						0 { return [DisplayHints ?row?] }
						1 { return [DisplayHints ?column?] }
					}
				}
				rowconfigure -
				columnconfigure {
					switch -- ${pos} {
						3 { return [DisplayHints <index>] }
						default {
							switch -- ${prev} {
								-minsize { return [DisplayHints <minsize>] }
								-weight { return [DisplayHints <weight>] }
								-pad { return [DisplayHints <pad>] }
								default {
									return [CompleteFromList ${text} \
									[RemoveUsedOptions ${line}  {
										-minsize -weight -pad
									}]]
								}
							}
						}
					}
				}
				configure {
					return [GridConfig ${text} ${start} ${line} ${prev}]
				}
				forget -
				remove {
					return [CompleteFromList ${text} [WidgetChildren ${text}]]
				}
				info {}
				location {
					switch -- ${pos} {
						3 { return [DisplayHints <x>] }
						4 { return [DisplayHints <y>] }
					}
				}
				propagate {
					switch -- ${pos} {
						3 { return [CompleteBoolean ${text}] }
					}
				}
				size {}
				slaves {
					switch -- ${prev} {
						-row { return [DisplayHints <row>] }
						-column { return [DisplayHints <column>] }
						default {
							return [CompleteFromList ${text} \
							[RemoveUsedOptions ${line}  { -row -column }]]
						}
					}
				}
				default {
					return [GridConfig ${text} ${start} ${line} ${prev}]
				}
			}
		}
	}
	return ""
}

proc complete(image) {text start end line pos mod} {
set sub [Lindex ${line} 1]
	switch -- ${pos} {
3904
3905
3906
3907
3908
3909
3910









3911
3912
3913
3914
3915
3916
3917
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590







+
+
+
+
+
+
+
+
+







				-width -xscrollcommand -yscrollcommand -height -selectmode
				-width
			}]
		}
	}
	return ""
}

proc complete(lower) {text start end line pos mod} {
	switch -- ${pos} {
		1 -
		2 {
			return [CompleteFromList ${text} [WidgetChildren ${text}]]
		}
	}
}

proc complete(menu) {text start end line pos mod} {
	switch -- ${pos} {
		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
		default {
			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
				-activebackground -activeborderwidth -activeforeground
3951
3952
3953
3954
3955
3956
3957



























































































































3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975




3976
3977
3978
3979
3980
3981
3982
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


















+
+
+
+







				-padx -pady -relief -takefocus -text -textvariable -width 
				-aspect -justify -width
			}]
		}
	}
	return ""
}

proc OptionPriority text {
	return [CompleteFromList ${text} {
		widgetDefault startupFile userDefault interactive
	}]
}

proc complete(option) {text start end line pos mod} {
	set sub [Lindex ${line} 1]
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} {
				add clear get readfile
			}]
		}
		2 {
			switch -- ${sub} {
				add { return [DisplayHints <pattern>] }
				get {
					return [CompleteFromList ${text} [WidgetChildren ${text}]]
				}
				readfile { return "" }
			}
		}
		3 {
			switch -- ${sub} {
				add { return [DisplayHints <value>] }
				get { return [DisplayHints <name>] }
				readfile { return [OptionPriority ${text}] }
			}
		}
		4 {
			switch -- ${sub} {
				add { return [OptionPriority ${text}] }
				get {
					return [CompleteFromList ${text} \
					[ClassTable [Lindex ${line} 2]]]
				}
				readfile {}
			}
		}
	}
}

proc PackConfig {text line prev} {
	set opts {
		-after -anchor -before -expand -fill
		-in -ipadx -ipady -padx -pady -side
	}
	if {-1 == [string first "-" ${line}]} {
		set slave [WidgetChildren ${text}]
	} else {
		set slave ""
	}
	switch -- ${prev} {
		-after -
		-before  { return [CompleteFromList ${text} [WidgetChildren ${text}]] }
		-anchor { return [CompleteAnchor ${text}] }
		-expand { return [CompleteBoolean ${text}] }
		-fill { return [CompleteFromList ${text} { none x y both }] }

		-ipadx -
		-ipady -
		-padx -
		-pady { return [DisplayHints <amount>] }

		-in { return [CompleteFromList ${text} [WidgetChildren ${text}]] }
		-side { return [CompleteFromList ${text} { left right top bottom }] }

		default {
			return [CompleteFromList ${text} \
			[RemoveUsedOptions ${line} [concat ${opts} ${slave}]]]
		}
	}
}

proc complete(pack) {text start end line pos mod} {
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	switch -- ${pos} {
		1 {
			return [CompleteFromList ${text} \
			[concat [WidgetChildren ${text}] {
				configure forget info propagate slaves
			}]]
		}
		2 {
			switch -- ${sub} {
				configure -
				forget -
				info -
				propagate -
				slaves {
					return [CompleteFromList ${text} [WidgetChildren ${text}]]
				}
				default {
					return [PackConfig ${text} ${line} ${prev}]
				}
			}
		}
		default {
			switch -- ${sub} {
				configure {
					return [PackConfig ${text} ${line} ${prev}]
				}
				forget {
					return [CompleteFromList ${text} [WidgetChildren ${text}]]
				}
				info {}
				propagate {
					switch -- ${pos} {
						3 { return [CompleteBoolean ${text}] }
					}
				}
				slaves {}
				default {
					return [PackConfig ${text} ${line} ${prev}]
				}
			}
		}
	}
	return ""
}

proc complete(radiobutton) {text start end line pos mod} {
	switch -- ${pos} {
		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
		default {
			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
				-activebackground -activeforeground -anchor -background
				-bitmap -borderwidth -cursor -disabledforeground -font
				-foreground -highlightbackground -highlightcolor
				-highlightthickness -image -justify -padx -pady -relief
				-takefocus -text -textvariable -underline -wraplength -command
				-height -indicatoron -selectcolor -selectimage -state -value
				-variable -width
			}]
		}
	}
	return ""
}

proc complete(raise) {text start end line pos mod} {
	return [complete(lower) ${text} ${start} ${end} ${line} ${pos} ${mod}]
}

proc complete(scale) {text start end line pos mod} {
	switch -- ${pos} {
		1 { return [EventuallyInsertLeadingDot ${text} <pathName>] }
		default {
			return [CompleteWidgetConfigurations ${text} ${start} ${line} {
				-activebackground -background -borderwidth -cursor -font
4292
4293
4294
4295
4296
4297
4298
4299














































4300
4301
4302
4303
4304

4305
4306
4307
4308
4309
4310
4311
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149

5150
5151
5152
5153
5154
5155
5156
5157








+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+




-
+







						-anchor -height -tags -width -window
					}]]
				}
			}
		}
	}
}

#**
# WidgetXviewYview
# 
# @param    text  -- the word to complete.
# @param    line  -- the line gathered so far.
# @param    pos   -- the current word position.
# @param    prev  -- the previous word.
# @return   a std tclreadline formatted completer string.
# @sa       CanvasObj, EntryObj
# @date     Sep-18-1999
#
proc WidgetXviewYview {text line pos prev} {
	switch -- ${pos} {
		2 { return [CompleteFromList ${text} {<index> moveto scroll}] }
		3 {
			switch -- ${prev} {
				moveto { return [DisplayHints <fraction>] }
				scroll { return [DisplayHints <number>] }
			}
		}
		4 {
			set subcmd [Lindex ${line} 2]
			switch -- ${subcmd} {
				scroll { return [DisplayHints <what>] }
			}
		}
	}
}

#**
# WidgetScan
# 
# @param    text  -- the word to complete.
# @param    pos   -- the current word position.
# @return   a std tclreadline formatted completer string.
# @sa       CanvasObj, EntryObj
# @date     Sep-18-1999
#
proc WidgetScan {text pos} {
	switch -- ${pos} {
		2 { return [CompleteFromList ${text} {mark dragto}] }
		3 { return [DisplayHints <x>] }
		4 { return [DisplayHints <y>] }
	}
}

proc CanvasObj {text start end line pos} {
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	if {1 == $pos} {
		return; # let the fallback routines do the job.
		return ""; # let the fallback routines do the job.
	}
	switch -- ${sub} {
		addtag {
			switch -- ${pos} {
				2 { return [DisplayHints <tag>] }
				3 {
					return [CompleteFromList ${text} {
4475
4476
4477
4478
4479
4480
4481
4482

4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
5321
5322
5323
5324
5325
5326
5327

5328






5329
5330
5331
5332
5333
5334
5335







-
+
-
-
-
-
-
-







				2 { return [DisplayHints <tagOrId>] }
				3 { return [DisplayHints <xOrigin>] }
				4 { return [DisplayHints <yOrigin>] }
				5 { return [DisplayHints <xScale>] }
				6 { return [DisplayHints <yScale>] }
			}
		}
		scan {
		scan { return [WidgetScan ${text} ${pos}] }
			switch -- ${pos} {
				2 { return [CompleteFromList ${text} {mark dragto}] }
				3 { return [DisplayHints <x>] }
				4 { return [DisplayHints <y>] }
			}
		}
		select {
			switch -- ${pos} {
				2 {
					return [CompleteFromList ${text} {
						adjust clear item from to
					}]
				}
4508
4509
4510
4511
4512
4513
4514
4515

4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
5348
5349
5350
5351
5352
5353
5354

5355
















5356
5357
5358
5359
5360
5361
5362







-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







						from -
						to { return [DisplayHints <index>] }
					}
				}
			}
		}
		xview -
		yview {
		yview { return [XviewYview ${text} ${line} ${pos} ${prev}] }
			switch -- ${pos} {
				2 { return [CompleteFromList ${text} {moveto scroll}] }
				3 {
					switch -- ${prev} {
						moveto { return [DisplayHints <fraction>] }
						scroll { return [DisplayHints <number>] }
					}
				}
				4 {
					set subcmd [Lindex ${line} 2]
					switch -- ${subcmd} {
						scroll { return [DisplayHints <what>] }
					}
				}
			}
		}
		create {
			switch -- ${pos} {
				2 {
					return [CompleteFromList ${text} {
						arc bitmap image line oval
						polygon rectangle text window
					}]
4589
4590
4591
4592
4593
4594
4595






4596
4597
4598
4599
4600
4601

4602
4603
4604



4605
4606
4607
4608
4609
4610
4611

4612
4613
4614
4615








4616
4617
4618
4619
4620
4621
4622
4623

4624
4625


4626
4627




4628
4629
4630
4631

4632
4633

4634
4635
4636
4637


4638
4639
4640
4641
4642

4643
4644
4645


4646



4647
4648
























































































































































































































































4649
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430

5431
5432
5433

5434
5435
5436
5437
5438

5439



5440

5441


5442
5443
5444
5445
5446
5447
5448
5449








5450
5451
5452
5453
5454


5455
5456
5457
5458
5459
5460
5461

5462


5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480

5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734







+
+
+
+
+
+





-
+


-
+
+
+


-

-
-
-
+
-

-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+


+
+
-
-
+
+
+
+



-
+
-
-
+




+
+





+



+
+
-
+
+
+


+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

					${end} ${line} ${pos} ${prev} ${type}]
				}
			}
		}
	}
	return ""
}

proc EntryIndex text {
	return [CompleteFromList ${text} {
		<number> <@number> anchor end sel.first sel.last
	}]
}

proc EntryObj {text start end line pos} {
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	if {1 == $pos} {
		return; # let the fallback routines do the job.
		return ""; # let the fallback routines do the job.
	}
	switch -- ${sub} {
		bbox {}
		bbox -
		icursor -
		index { return [EntryIndex ${text}] }
		cget {}
		configure {}
		delete {}
		get {}
		icursor {}
		index {}
		insert {}
		insert {
		scan {
			switch -- ${pos} {
				2 { return [CompleteFromList ${text} {mark dragto}] }
				3 { return [DisplayHints <x>] }
				2 { return [EntryIndex ${text}] }
				3 { return [DisplayHints <string>] }
			}
		}
		scan { return [WidgetScan ${text} ${pos}] }
		selection {
			switch -- ${pos} {
				# let the fallback routines do the job.
				4 { return [DisplayHints <y>] }
			}
		}
		selection {}
		xview -
		yview {
			switch -- ${pos} {
				2 { return [CompleteFromList ${text} {moveto scroll}] }
				2 { return "" }
				3 {
					switch -- ${prev} {
						adjust -
						from -
						moveto { return [DisplayHints <fraction>] }
						scroll { return [DisplayHints <number>] }
						to { return [EntryIndex ${text}] }
						clear -
						present {}
						range { return [DisplayHints <start>] }
					}
				}
				4 {
					set subcmd [Lindex ${line} 2]
					switch -- [Lindex ${line} 2] {
					switch -- ${subcmd} {
						scroll { return [DisplayHints <what>] }
						range { return [DisplayHints <end>] }
					}
				}
			}
		}
		xview -
		yview { return [WidgetXviewYview ${text} ${line} ${pos} ${prev}] }
	}
	return ""
}

# proc CheckbuttonObj {text start end line pos} {
# the fallback routines do the job pretty well.
# }

# proc FrameObj {text start end line pos} {
# the fallback routines do the job pretty well.
# }
# 	return ""

# proc LabelObj {text start end line pos} {
# the fallback routines do the job pretty well.
# }

proc ListboxObj {text start end line pos} {
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	if {1 == $pos} {
		return ""; # let the fallback routines do the job.
	}
	switch -- ${sub} {
		activate -
		bbox -
		index -
		see {
			switch -- ${pos} {
				2 {
					return [DisplayHints <index>]
				}
			}
		}
		insert {
			switch -- ${pos} {
				2 {
					return [DisplayHints <index>]
				}
				default {
					return [DisplayHints ?element?]
				}
			}
		}
		cget {}
		configure {}
		curselection {}
		delete -
		get {
			switch -- ${pos} {
				2 {
					return [DisplayHints <first>]
				}
				3 {
					return [DisplayHints ?last?]
				}
			}
		}
		nearest {
			switch -- ${pos} {
				2 {
					return [DisplayHints <y>]
				}
			}
		}
		size {}     

		scan { return [WidgetScan ${text} ${pos}] }

		xview -
		yview { return [WidgetXviewYview ${text} ${line} ${pos} ${prev}] }

		selection {
			switch -- ${pos} {
				2 {
					return [CompleteFromList ${text} \
					{anchor clear includes set}]
				}
				3 {
					switch -- ${prev} {
						anchor -
						includes {
							return [CompleteFromList ${text} {
								active anchor end @x @y <number>
							}]
						}
						clear -
						set { return [DisplayHints <first>] }
					}
				}
				4 {
					switch -- [Lindex ${line} 2] {
						clear -
						set { return [DisplayHints ?last?] }
					}
				}
			}
		}
	}
}

proc MenuIndex text {
	return [CompleteFromList ${text} {
		<number> active end last none <@number> <labelPattern>
	}]
}

proc MenuItem {text start end line pos virtualpos} {
	switch -- ${virtualpos} {
		2 {
			return [CompleteFromList ${text} {
				cascade checkbutton command radiobutton separator
			}]
		}
		default {
			switch -- [PreviousWord ${start} ${line}] {
				-activebackground -
				-activeforeground -
				-background -
				-foreground -
				-selectcolor {
					return [DisplayHints <color>]
				}

				-accelerator { return [DisplayHints <accel>] }
				-bitmap { return [CompleteFromBitmaps ${text}] }

				-columnbreak -
				-hidemargin -
				-indicatoron {
					return [CompleteBoolean ${text}]
				}
				-command {
					return [BraceOrCommand ${text} \
					${start} ${end} ${line} ${pos} ${text}]
				}
				-font {
					set names [font names]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <fontname>]
					}
				}
				-image -
				-selectimage {
					set names [image names]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <image>]
					}
				}

				-label { return [DisplayHints <label>] }
				-menu {
					set names [WidgetChildren [Lindex ${line} 0]]
					if {[string length ${names}]} {
						return [CompleteFromList ${text} ${names}]
					} else {
						return [DisplayHints <menu>]
					}
				}

				-offvalue -
				-onvalue { return [DisplayHints <value>] }

				-state {
					return [CompleteFromList ${text} {
						normal active disabled
					}]
				}
				-underline { return [DisplayHints <integer>] }
				-value { return [DisplayHints <value>] }
				-variable {
					return [VarCompletion ${text} #0]
				}

				default {
					return [CompleteFromList ${text} \
					[RemoveUsedOptions ${line} {
						-activebackground -activeforeground
						-accelerator -background -bitmap -columnbreak
						-command -font -foreground -hidemargin -image
						-indicatoron -label -menu -offvalue -onvalue
						-selectcolor -selectimage -state -underline
						-value -variable
					}]]
				}
			}
		}
	}
}

proc MenuObj {text start end line pos} {
	set sub [Lindex ${line} 1]
	set prev [PreviousWord ${start} ${line}]
	if {1 == $pos} {
		return ""; # let the fallback routines do the job.
	}
	switch -- ${sub} {
		activate -
		index -
		invoke -
		postcascade -
		type -
		yposition {
			switch -- ${pos} {
				2 {
					return [MenuIndex ${text}]
				}
			}
		}
		configure {}
		cget {}

		add {
			return [MenuItem ${text} ${start} ${end} ${line} ${pos} ${pos}]
		}
		clone {
			switch -- ${pos} {
				2 { return [DisplayHints <newPathname>] }
				3 {
					return [CompleteFromList ${text} {
						normal menubar tearoff
					}]
				}
			}
		}
		delete {
			switch -- ${pos} {
				2 -
				3 { return [MenuIndex ${text}] }
			}
		}
		insert {
			switch -- ${pos} {
				2 { return [MenuIndex ${text}] }
				default {
					return [MenuItem ${text} ${start} ${end} \
					${line} ${pos} [expr ${pos} - 1]]
				}
			}
		}
		entrycget -
		entryconfigure {
			switch -- ${pos} {
				2 { return [MenuIndex ${text}] }
				default {
					return [MenuItem ${text} ${start} \
					${end} ${line} ${pos} ${pos}]
				}
			}
		}
		post {
			switch -- ${pos} {
				2 { return [DisplayHints <x>] }
				3 { return [DisplayHints <y>] }
			}
		}
		# ??? XXX
		unpost {}
	}
}

}; # namespace tclreadline