Check-in [a8f8df8300]
Not logged in
Overview
Comment: Modified Files: .login Added Files: .tclcrystalrc Removed Files: .csymrc ---------------------------------------------------------------------- tcl_ft.vim tclreadline.c tclreadline.n.in tclreadlineCompleter.tcl tclreadlineSetup.tcl.in
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a8f8df8300aa49bffe98ecd20a1575963e526c33
User & Date: johannes@zellner.org on 1999-09-16 17:38:26
Other Links: manifest | tags
Context
1999-09-17
00:44
Modified Files: src/tclcrystal/.tclcrystalrc src/tclcrystal/Makefile.in src/tclcrystal/configure.in src/tclcrystal/crystal.cc src/tclreadline/README src/tclreadline/tclreadlineCompleter.tcl src/tclreadline/tclreadlineSetup.tcl.in check-in: 1f6689ebb8 user: johannes@zellner.org tags: trunk
1999-09-16
17:38
Modified Files: .login Added Files: .tclcrystalrc Removed Files: .csymrc ---------------------------------------------------------------------- tcl_ft.vim tclreadline.c tclreadline.n.in tclreadlineCompleter.tcl tclreadlineSetup.tcl.in check-in: a8f8df8300 user: johannes@zellner.org tags: trunk
09:30
tclreadlineCompleter.tcl check-in: c4f1436684 user: johannes@zellner.org tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified tclreadline.c from [8639d7447d] to [42d7384f97].

     1      1   
     2      2    /* ==================================================================
     3      3   
     4         -    FILE: "/home/joze/src/tclreadline/tclreadline.c"
     5         -    LAST MODIFICATION: "Wed Sep 15 01:00:43 1999 (joze)"
            4  +    FILE: "/disk01/home/joze/src/tclreadline/tclreadline.c"
            5  +    LAST MODIFICATION: "Thu Sep 16 15:43:29 1999 (joze)"
     6      6       (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
     7      7       $Id$
     8      8       ---
     9      9   
    10     10       tclreadline -- gnu readline for tcl
    11     11       Copyright (C) 1999  Johannes Zellner
    12     12   
................................................................................
   187    187   {
   188    188       int i, obj_idx, status;
   189    189       Tcl_Obj** objv = (Tcl_Obj**) MALLOC((argc + 1) * sizeof(Tcl_Obj *));
   190    190   
   191    191       static char *subCmds[] = {
   192    192           "read", "initialize", "write", "add", "complete",
   193    193           "customcompleter", "builtincompleter", "eofchar",
          194  +		"reset-terminal",
   194    195           (char *) NULL
   195    196       };
   196    197       enum SubCmdIdx {
   197    198           TCLRL_READ, TCLRL_INITIALIZE, TCLRL_WRITE, TCLRL_ADD, TCLRL_COMPLETE,
   198         -        TCLRL_CUSTOMCOMPLETER, TCLRL_BUILTINCOMPLETER, TCLRL_EOFCHAR
          199  +        TCLRL_CUSTOMCOMPLETER, TCLRL_BUILTINCOMPLETER, TCLRL_EOFCHAR,
          200  +		TCLRL_RESET_TERMINAL
   199    201       };
   200    202   
   201    203   
   202    204       Tcl_ResetResult(interp); /* clear the result space */
   203    205   
   204    206       for (i = 0;  i < argc;  i++) {
   205    207           Tcl_Obj* objPtr = Tcl_NewStringObj(argv[i], -1);
................................................................................
   365    367                   if (tclrl_eof_string)
   366    368                       FREE(tclrl_eof_string);
   367    369                   if (!blank_line(argv[2]))
   368    370                       tclrl_eof_string = stripwhite(strdup(argv[2]));
   369    371               }
   370    372               Tcl_AppendResult(interp, tclrl_eof_string, (char*) NULL);
   371    373               break;
          374  +
          375  +        case TCLRL_RESET_TERMINAL:
          376  +			/* TODO: add this to the completer */
          377  +            if (argc > 3) {
          378  +                Tcl_WrongNumArgs(interp, 2, objv, "?terminal-name?");
          379  +                return TCL_ERROR;
          380  +            } else if (3 == argc) {
          381  +				rl_reset_terminal(Tcl_GetString(objv[2]));
          382  +            } else {
          383  +				rl_cleanup_after_signal();
          384  +			}
          385  +            break;
   372    386   
   373    387           default:
   374    388               goto BAD_COMMAND;
   375    389               /* NOTREACHED */
   376    390               break;
   377    391       }
   378    392   

Modified tclreadline.n.in from [9b636f5135] to [72c7fb52c1].

     1      1   .TH tclreadline n "@TCLREADLINE_VERSION@.@TCLREADLINE_PATCHLEVEL@" "Johannes Zellner"
     2      2   
     3      3   .\" (C) 1999 by Johannes Zellner
     4         -.\" FILE: "/diska/home/joze/src/tclreadline/tclreadline.n.in"
     5         -.\" LAST MODIFICATION: "Mon Aug 30 14:12:14 1999 (joze)"
            4  +.\" FILE: "/disk01/home/joze/src/tclreadline/tclreadline.n.in"
            5  +.\" LAST MODIFICATION: "Thu Sep 16 18:10:41 1999 (joze)"
     6      6   .\" (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
     7      7   .\" $Id$
     8      8   .\" ---
     9      9   .\"
    10     10   .\" tclreadline -- gnu readline for the tcl scripting language
    11     11   .\" Copyright (C) 1999  Johannes Zellner
    12     12   .\"
................................................................................
   175    175   .TP 5
   176    176   \fB::tclreadline::readline write\fP \fIhistoryfile\fP
   177    177   writes the history to the \fIhistoryfile\fP. This command is called
   178    178   automatically from the internal routine ::tclreadline::Exit.
   179    179   If the variable \fBtclreadline::historyLength\fP is non-negative,
   180    180   the historyfile will be truncated to hold only this number lines.
   181    181   
          182  +.TP 5
          183  +\fB::tclreadline::readline reset-terminal\fP [\fIterminalName\fP]
          184  +w/o argument: reset the state of the terminal to what it was
          185  +before tclreadline was used. With argument: reinitialize readline's
          186  +idea of the terminal settings using terminalName as the terminal type.
          187  +
   182    188   .TP 5
   183    189   \fB::tclreadline::Print\fP [\fIyes / no\fP]
   184    190   turns on or off the default behavior of tclsh to print the result of
   185    191   every command. This is turned on by default, so it will just behave
   186    192   as the tclsh w/o tclreadline. Turning off might be useful, when reading
   187    193   binary data for example. If \fB::tclreadline::Print\fP is called w/o
   188    194   arguments, it returns the current setting.

Modified tclreadlineCompleter.tcl from [f9084f3db9] to [66fd51af9c].

     1      1   # -*- tclsh -*-
     2      2   # FILE: "/disk01/home/joze/src/tclreadline/tclreadlineCompleter.tcl"
     3         -# LAST MODIFICATION: "Thu Sep 16 02:53:18 1999 (joze)"
            3  +# LAST MODIFICATION: "Thu Sep 16 16:24:46 1999 (joze)"
     4      4   # (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
     5      5   # $Id$
     6      6   # ---
     7      7   #
     8      8   # tclreadline -- gnu readline for tcl
     9      9   # Copyright (C) 1999  Johannes Zellner
    10     10   #
................................................................................
   980    980   	} else {
   981    981   
   982    982   		# try to use $pos further ...
   983    983   		# puts stderr |$line|
   984    984   		#
   985    985   		if {"." == [string index [string trim ${line}] 0]} {
   986    986   			set alias WIDGET
   987         -			set namespc ""
          987  +			set namespc ""; # widgets are always in the global
   988    988   		} else {
   989    989   
   990    990   			# the double `lindex' strips {} or quotes.
   991    991   			# the subst enables variables containing
   992    992   			# command names.
   993    993   			#
   994    994   			set alias [uplevel [info level] \
................................................................................
  1035   1035   					[namespace eval ::tclreadline::${namespc} \
  1036   1036   					[list complete(${cmd}) $part $start $end $line $pos $mod]]]\
  1037   1037   					::tclreadline::errorMsg]
  1038   1038   				} {
  1039   1039   					error [list error during evaluation of `complete(${cmd})']
  1040   1040   				}
  1041   1041   				# puts stderr \nscript_result=|${script_result}|
  1042         -				return ${script_result}
         1042  +				if {[string length ${script_result}] || \
         1043  +					"tclreadline_complete_unknown" == ${cmd}
         1044  +				} {
         1045  +					return ${script_result}
         1046  +				}
  1043   1047   			}
  1044   1048   			# set namespc ""; # no qualifiers for tclreadline_complete_unknown
  1045   1049   		}
  1046   1050   
  1047   1051   		# as we've reached here no valid specific completer
  1048   1052   		# was found. Check, if it's a proc and return the
  1049   1053   		# arguments.
................................................................................
  2034   2038   	}
  2035   2039   	return ""
  2036   2040   }
  2037   2041   
  2038   2042   proc complete(lappend) {text start end line pos mod} {
  2039   2043   	switch -- $pos {
  2040   2044   		1 { return [VarCompletion ${text}] }
  2041         -		default { return [DisplayHints ?value?] }
         2045  +		default { return [TryFromList ${text} ?value?] }
  2042   2046   	}
  2043   2047   	return ""
  2044   2048   }
  2045   2049   
  2046   2050   # the following routines are described in the
  2047   2051   # `library' man page.
  2048   2052   # --- LIBRARY ---
................................................................................
  2972   2976   }
  2973   2977   
  2974   2978   proc tclreadline::complete(readline) {text start end line pos mod} {
  2975   2979   	set cmd [Lindex $line 1]
  2976   2980   	switch -- $pos {
  2977   2981   		1 { return [CompleteFromList ${text} {
  2978   2982   			read initialize write add complete
  2979         -			customcompleter builtincompleter eofchar}]
         2983  +			customcompleter builtincompleter eofchar reset-terminal}]
  2980   2984   		}
  2981   2985   		2 {
  2982   2986   			switch -- $cmd {
  2983   2987   				read {}
  2984   2988   				initialize {}
  2985   2989   				write {}
  2986   2990   				add { return [DisplayHints <completerLine>] }
  2987   2991   				completer { return [DisplayHints <line>] }
  2988   2992   				customcompleter { return [DisplayHints ?scriptCompleter?] }
  2989   2993   				builtincompleter { return [DisplayHints ?boolean?] }
  2990   2994   				eofchar { return [DisplayHints ?script?] }
         2995  +				reset-terminal {
         2996  +					if {[info exists ::env(TERM)]} {
         2997  +						return [CompleteFromList ${text} $::env(TERM)]
         2998  +					} else {
         2999  +						return [DisplayHints ?terminalName?]
         3000  +					}
         3001  +				}
  2991   3002   			}
  2992   3003   		}
  2993   3004   	}
  2994   3005   	return ""
  2995   3006   }
  2996   3007   
  2997   3008   # --- END OF TCLREADLINE PACKAGE ---

Modified tclreadlineSetup.tcl.in from [4dfd34c126] to [4d1fefee5e].

     1      1   #!/usr/locanl/bin/tclsh
     2      2   # FILE: "/disk01/home/joze/src/tclreadline/tclreadlineSetup.tcl.in"
     3         -# LAST MODIFICATION: "Wed Sep 15 15:23:30 1999 (joze)"
            3  +# LAST MODIFICATION: "Thu Sep 16 18:06:23 1999 (joze)"
     4      4   # (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
     5      5   # $Id$
     6      6   # ---
     7      7   #
     8      8   # tclreadline -- gnu readline for tcl
     9      9   # Copyright (C) 1999  Johannes Zellner
    10     10   #
................................................................................
   134    134   		}
   135    135   	}
   136    136   	return -code error "invalid command name \"$name\""
   137    137   }
   138    138   
   139    139   namespace eval tclreadline {
   140    140   
   141         -namespace export Setup Glob Loop InitTclCmds InitTkCmds Print ls
          141  +namespace export Setup Loop InitTclCmds InitTkCmds Print ls
   142    142   
   143    143   proc ls {args} {
   144    144   	if {[exec uname -s] == "Linux"} {
   145    145   		eval exec ls --color -FC [Glob $args]
   146    146   	} else {
   147    147   		eval exec ls -FC [Glob $args]
   148    148   	}
................................................................................
   201    201   
   202    202   				if {[catch {
   203    203   					::tclreadline::readline write \
   204    204   					[::tclreadline::HistoryFileGet]
   205    205   				} ::tclreadline::errorMsg]} {
   206    206   					puts stderr $::tclreadline::errorMsg
   207    207   				}
          208  +
          209  +				::tclreadline::readline reset-terminal
   208    210   
   209    211   				if [catch "eval ::tclreadline::Exit $args" message] {
   210    212   					puts stderr "error:"
   211    213   					puts stderr "$message"
   212    214   				}
   213    215   				# NOTREACHED
   214    216   			}
................................................................................
   245    247   }
   246    248   
   247    249   proc HistoryFileGet {} {
   248    250   	variable historyfile
   249    251   	return $historyfile
   250    252   }
   251    253   
          254  +# obsolete
          255  +#
   252    256   proc Glob {string} {
   253    257   
   254    258   	set commandstring ""
   255    259   	foreach name $string {
   256    260   		set replace [glob -nocomplain -- $name]
   257    261   		if {$replace == ""} {
   258    262   			lappend commandstring $name