User's Guide to the Tcl Shell Window

A shell window in Tycho provides a shell for interacting with the Tcl interpreter. Note that Tk and Itcl are understood by this interpreter, as are, of course, all Tycho commands. If you are running a version of Tycho with Ptolemy attached, the ptcl commands are also understood. Commands are executed at the global scope. A shell windows is derived from the Edit window, and therefore inherits all of its features. This page documents the additional features provided.

Key Bindings

Return
execute the current line as a Tcl command
C-a
go to the beginning of the command
C-e
go to the end of the command
C-k
erase to the end of the command (save to clipboard)
C-n
down one command
C-p
up one command
C-u
erase the current command (save to clipboard)

These bindings can be used to scroll back to previous commands, edit them, and re-execute them. The bindings are designed to be maximally convenient for single line commands, but they can still be used if the commands themselves have multiple lines. However, it takes some getting used to. In particular, Control-p will not move the insertion cursor up one line a multi-line command, but rather will erase the current command altogether and replace it with the previous command in the command history. Similarly, Control-n will not move down one line in a multi-line command. To edit a multi-line command, use Control-b and Control-f or Meta-b and Meta-f to move around within the command. Note also that Control-k does not delete to the end of the current line, but rather deletes to the end of the command.

Special Features

The Shell window has a number of features designed to make it easier to experiment with Tcl scripts. Foremost among these is the history mechanism, which keeps a record of previously executed commands. A "Special" menu provides two commands related to this:

Edit history
Open a window that contains the history (previously executed commands) for the specified shell window. This is opened as an Itcl context-sensitive editor, so it can be edited and evaluated.
Clear history
Reset the history buffer.

Note that the Save-As command, unlike the Edit history command, saves a snapshot of the previously executed command together with the returned values and prompts. Thus, it provides a mechanism for documenting an interaction with the Tcl interpreter.

Standard Output

If a shell window has been designated "master" (using the -master option), then it will capture standard output generated by the Tcl puts command, unless that output is redirected to a file. If you start Tycho with a shell window, that shell window is a master shell window. Note that for output to appear in the master shell window it may be necessary to call "update", "update idletasks", or "::tycho::saferUpdate".

A second feature of a master shell window is that when it is dismissed, the program is exited (after confirmation, of course).

Tycho Home Page


Copyright © 1996, The Regents of the University of California. All rights reserved.
Last updated: 96/11/07, comments to: eal@eecs.berkeley.edu