Recent Changes - Search:


Ted /

Overview

(:toc:)

Overview

Ted is a programming editor with basic features such as undo, buffers, marks, and syntax highlighting, and advanced features such as Filtering, CTags and Command Completion. Ted is written entirely in Tcl/Tk script, which makes it easy to extend. Ted also employs and/or emulates Unix facilities such as gdb, ctags, and revision control ala rcs/cvs/svn.

In addition to editing, Ted also can be used as a debugger front-end (when run as tdb). TDB provides a GUI interface for debuggers such as gdb and Wize, allowing it to debug both compiled and Tcl programs. Nevertheless, Ted remains small and responsive.

Command completion in Ted is provided using several techniques: syntax highlighting keywords, Ctags and Tcl/Tk commands and their options. Thus while Tcl completion is the major target, other languages such as C are also supported via ctags.

Usage

Despite it's being a GUI application, Ted is normally started from the command line. ie.

ted FILENAME

Configuration for Ted is read first from ~/ and then the startup directory; all opened editor windows will then share this configuration.

Ted may also be started as a debugger tdb thus:

tdb a.out arg1 arg2 ...

Appearance

Ted sports a rather spartan user interface, foregoing the unnecessary use of icons. Also, Ted provides a limited keyboard shortcuts, relying instead on the use of menu hot-keys. For example, <Alt-f>p to open the Previous-Files menu.

Selection Model

For the most part, Ted uses Tk's standard Text widget key-bindings which is similar to keystrokes used in Mozilla, Windows, etc. However, there are changes. Some of the movement keys are unique, and there are differences in the behaviour of Copy, Cut and Paste. For example, Tk Cut and Copy without selecting something has no visible effect. In Ted, however, this causes the current line to be Cut or Copied. On the other hand, when there is a selection, Copy will deselect.

The paste key is changed to <Control-v>, as in Windows. Using paste with text selected causes text replacement. Finally, text that is pasted will remain selected until the Control key is released: this allows further possible <Control> operations on the selection.

Syntax Highlighting

Ted implements dynamic syntax highlighting which is applied incrementally as a page scrolls. Re-highlighting is triggered when cetain characters are typed, such as <Return> or <Control-=>. Nevertheless, a sure way to force rehighlighting is to scroll down a page, then back up.

Indent Formatting

Ted implements generalized, language independent auto-indentation, based on curly brace matching. Specifically, formatting is limited to managing leading spaces in lines based only upon the '{' and '}' braces at the start and end of lines respectively. A line ending in an open brace increases indent, and a line containing just closing braces decreases indent.

There are two special cases: a line whose first char is a hash "#" will never indented. And a line ending in a backslash when the next line starts with an open-brace indicates a block that is to be untouched.

While not perfect, this indent strategy is general enough to handle well-formed code and data for both Tcl and C.

Folding

Text block folding (hiding) is implemented, either on selections or using curly braces. If a block is selected and <Control-]> used, the selection is folded. If nothing is selected, and the current line ends in an open curly brace, then that block is folded to the matching end-brace. If the line was already folded, it gets unfolded. The menu entry Edit/Fold/Fold-All may also be used to fold every section starting from the cursor to the end of file.

Note: there is a known bug in cursor motion through hidden text that is fixed in Tk 8.5.

Tcl Features

Ted simplifies editing Tcl by providing Command Completion and working with Wize, the Tcl validator and debugger from PDQ Interfaces Inc (http://pdqi.com). Wize supports true debugging of Tcl programs, as well as advanced integrity checking. The debugging feature of Wize implements a subset of gdb's command set and so can work in place of or on top of gdb. This fact makes it trivial to debug both C and Tcl at the same time. Wize is available from http://pdqi.com.

Options

All options for Ted are read from .tedcnf, first from the home directory then from the current directory. To set options globally for a user, they should be changed while running TED from the home directory. This file contains only the values for options that are different from the defaults. It also contains the recently accessed files.

Menus

Menus in Ted are defined in the files Main-menu.tcl and Edit-menu.tcl. When traversing menus in Ted, a help string describing each menu entries function appears in the status at the bottom of the window. Moreover, when a longer description is available, this message includes <F1> which hitting brings up the description window with the complete available description. Moreover, within this is an option to view the code, whereupon an option is available to edit the code (when editing Ted itself). All this means is there is a direct path to inspect or edit any code available from the main menu.

A second feature of menus is that of Help/Menus-List which provides a search-able text window containing all menu functions, with descriptions.

Modifications

Ted provides access to several types of version control whereby each time a file is saved, a checkin occurs. Support is available for RCS, CVS, and SVN, all or none of which may be used. Of these, RCS is of interest since Ted implements it internally (for use on windows). It requires no real setup, other than creating an RCS sub-directory, and supports interactive review and rollback. Moreover, under Unix a unified diff file can automatically be generated for the files in the current directory using Help/Development/RCSDiff. This provides a snapshot of all changes made by the user.

Console

The Ted Help/Console provides access to the Tk Console, even on Unix. This works the same as Windows except that you use putc instead of puts to send output to the console window. (puts is transformed automatically).

The Help/Devel/Ted-Console menu entry gives internal access to the running editor. This means for example that typing exit will cause the editor to vanish. However, it also means that that the editor can be changed on the fly, simply by typing or pasting code into it.

Edit - History - Print - Recent Changes - Search
Page last modified on June 04, 2009, at 08:18 AM