screen bugs/features
Wayne Davison
davison at drivax.DRI
Wed Feb 22 14:41:07 AEST 1989
I've been doing a lot of twiddling with screen lately. In the process, I've
fixed some bugs, added some features, and made some minor optimizations to the
code. I was about to send my diffs (about 60k worth) to Oliver for him to mull
over, but it appears that he doesn't have any time right now to devote to
working on screen. So I thot I'd mention what I've been doing, and see if
anyone else out there might like to swap changes. If there's enough general
interest in what I've done, I could post the diffs to comp.sources.unix, or
comp.sources.bugs, or whatever.
Bugfixes:
---------
o If MakeWindow() fails, there are cases where the opened PTY is not
closed, nor is partially allocated memory freed. In fact, I found
that the "tabs" array is never freed at any point, even when you
delete a window. I've reordered allocation in MakeWindow and call
a modified FreeWindow from more places in MakeWindow to fix this.
o Whenever a background window turns the keypad or insert mode on/off,
screen incorrectly toggles the internal state of keypad or insert
even though the physical mode of these items has not changed.
o When detaching or suspending screen, the keypad and insert mode
need to be turned off and stdout flushed. As it works now, screen
might leave these on and will expect them to still be on when
restarted.
o ClearScreen() is called twice in ansi.c and followed by a Goto()
that has two different assumptions for the "from" field of the
current cursor position. The code should assume that the cursor
was homed by the clear-screen string.
o There's a few spots where curr->bot should be referrenced for the last
line in the scrolling region, not rows-1 for the last screen line.
o I fixed auto-margin support by advertising `am' in the termcap if your
terminal is such a terminal and then correctly emulating it. This
allows screen to display that last character of the last line in
normal circumstances. The only time it doesn't display it is when
you switch screen into nowrap mode on an `am' terminal.
o As Paul Lew already noted, changing the default escape key with the
escape command in .screenrc does not set the default escape-escape
action. However, the correct solution is NOT to re-order the call
to InitKeytab(), since it could possibly override "bind" commands
made in the .screenrc. The correct solution is to add the line:
ktab[Esc].type = KEY_OTHER;
into the processing of the escape command.
o Goto() erroneously forced an x,y cursor move when going to the first
or last line of the scrolling region or when moving around outside
the scrolling region. It should only do this when going from inside
to outside the scrolling region.
o RewriteCost() erroneously thinks that rewriting UP TO rows-1 is
"EXPENSIVE".
o The DeleteChar() & InsertChar() code simply return if the emulator
is in the "pseudo-last column" of the line (the spot after writing
a character to the last column of a line). It should remove the
last character of the line.
Added features:
---------------
o Made flow control selectable on a per-console basis. This lets you
run shells with flow control, and editors (such as emacs) without
and switch back and forth.
o Added flow-toggle mode that turns flow control on/off for the current
console when the application keypad turns off/on (respectivly).
o Added the -f/ command line option to select the flow-toggle mode from
the command line.
o Added keystroke commands and default bindings to:
toggle flow control on/off (C-A f, C-A C-F)
toggle flow-toggle on/off (C-A /)
toggle wrap on/off (C-A r, C-A C-R)
clear the screen (C-A C)
reset the virtual terminal (C-A Z)
o Added .screenrc commands to:
set default flow mode (flow on|off|toggle)
set default wrap mode (wrap on|off)
o I put all the windows in a most-recently-used linked list so that
the "other" window we switch to (with C-A C-A) is always the most
recently accessed window (besides the current window), no matter
how many windows have been deleted.
o Added left margin ^H line-wrap when in wrap mode. This kinda rounds
out the "wrap when a second character is written into the right margin"
feature of screen, and lets simple-minded applications (like csh)
edit a wrapped command line.
o Added interrupt option (-i) which will immediately terminate the
output when ^C is pressed. Currently, screen might scroll another
8 lines or more before stopping. The only trade-off, is that the
virtual screen memory contains the extra "8" lines of output, not
the abbreviated version. You won't notice that fact too often,
however.
Optimizations:
--------------
o Removed the GotArg array in ansi.c. It was completely redundant with
a parameter value of 0.
o Made clear-to-eol work on non-LP terminals w/o CE but with DC.
o Correctly set last_x & last_y on exit of DisplayLine so that the
Goto() kludge that forced an x,y cursor move isn't needed.
o Bind now requires the \ in front of an octal number. This lets you
bind the numeric keys without resorting to octal, and also lets the
bind command use the same translate code as the -e option.
o I redid the insert code to selectivly choose between IC and IM if
both are specified for a terminal.
o Made large arrays malloc'ed.
o Optimized scrolling of interal character maps and ClearScreen.
--
Wayne Davison ...amdahl!drivax!davison
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Qn qyrzx zkhn ly ubbren tyr loul lon crkxnx skbbkznb jreenplzt jypwneckpc
qklo tyre bokf uen fuel ya u bfnjkuz bnewkjn qn ndlnpx ly uzz ya yre sybl
nplorbkublkj jzknplb, upx lon arzzt uesnx prjznue queonuxb uen, ya jyrebn
snenzt u jyrelnbt xnlukz. Qn zyyh ayequex ly tyre jrblys kp arlren zkwnb.
-- Lon Okljookhne'b Crkxn ly lon Cuzudt
More information about the Comp.sources.bugs
mailing list