Hi!
Over the last four months I've been working on the tkterm and virterm terminal emulators distributed in expect/example, turning them into
reusable software components that work well enough to drive the test suite
for a vi clone.
git clone git://
github.com/martinwguy/xvi
cd xvi
make check
I just wondered if there is any interest in including these - a fixed tkterm,
a working virterm and a standalone term_expect - in the standard distribution.
For tkterm, the changes were:
- add missing termcap booleans :am:bs:xn: and to terminfo am,xenl
- add missing termcap strings le sf and cr and terminfo's cub1 and cud1
- add strings send by the F10 key, the arrow keys, PgUp, PgDn, Home, End,
Insert and Delete
- Bind these keys so that tkterm sends the appropriate strings
- fix a bug in clear-to-end-of-line while in standout mode (it used to clear
to the standout colour, but should clear to the background colour)j
- call "update idletasks" on every CR, not every 24th one, as this caused
random failures of a test that produces a lot of output
- make its cursor motion string index from 1 instead of 0 to be more similar
to ansi, vt100 and xterm, thereby making development easier.
In virterm instead te changes are more widespread, including
- Remove the trailing script to interrogate the Cornell Library Catalog
- It seems to be based on an older version of tkterm, so update the code
they have in common to what's in the latest tkterm.
- Fill out its feature set to match tkterm and the above changes,
except for the graphic charset, standout mode and scrollbars.
term_expect is reduced to just the code of term_expect() instead of including
a copy of tkterm and a following rogue example, so it can be used by both
tkterm and virterm and
- set the strobe when the cursor position changes, otherwise you can't
match tests that only move the cursor but don't change the screen contents
- fixes a bug in its error reporting
I also have a couple of technical questions, as I'm new to Tcl
With tkterm, I've tried to bind the Insert key using
bind $term <Insert> {exp_send -i $term_spawn_id "\033\[2~"}
but if I press the Insert key in the terminal window, the text in X's
mouse-driven copy-paste buffer (what you get by click-dragging in a text
window) is scribbled onto the terminal's screen at the cursor position but
no characters are sent to vi. The same happens if I click the left mouse
button in the terminal window, pasting the mouse buffer at the position I click. This seems to be a predefined behaviour of the text widget but I can't find any mention of it in the docs for Tk's "text" builtin. Is there a way
to turn this off so that pressing Insert makes it send the control sequence
to the application running in the terminal?
I've had to comment out the new window-resizing code in development because
scan [wm geometry .] "%dx%d" rows cols
throws an error window on startup saying:
variable is not assigned by any conversion specifiers
while executing
"scan [wm geometry .] "??x??" rows cols"
I'm not sure where those ??'s came from! However, if I open tclsh and say
package require Tk
scan [wm geometry .] "%dx%d" rows cols
it works. That's using Tcl8.6 on current Debian and Ubuntu on i386 and amd64.
It looks like the format string is getting corrupted in the interpreter
before it is handed to "scan". Is this a known bug?
Many thanks & enjoy!
M