diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-07-01 21:40:16 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-26 21:52:22 -0700 |
commit | 28402bd4de6a1f46eec0d3519d9cb2eb63d59a5b (patch) | |
tree | de3f1d5f30122186b4afa67ef14817093d7b9a32 /winsup/cygwin/fhandler.h | |
parent | 5bd0a181871a99960ecf96e821dab6de4aa2136f (diff) | |
download | cygnal-28402bd4de6a1f46eec0d3519d9cb2eb63d59a5b.tar.gz cygnal-28402bd4de6a1f46eec0d3519d9cb2eb63d59a5b.tar.bz2 cygnal-28402bd4de6a1f46eec0d3519d9cb2eb63d59a5b.zip |
Console: provide VT100-like end-of-line print behavior.
On the majority of VT100-like terminals, when you print a
character in the last column, the cursor sits in a kind of
"limbo", as if the cursor position were one column past the
edge of the screen. Thus when a line feed is output next,
the cursor is then at the start of the next line.
The Win32 console write doesn't do this; the cursor position
wraps to the start of the next line. If a newline is put out,
it translates to an extra newline going to the next-next line.
This spoils the behavior of programs which depend on the VT100
behavior.
In this patch, the VT100 behavior is simulated as follows. A
new flag in the dev_console structure is set when a character
is output to the last column. This flag is then observed in
order to discard a newline (or rather any character which is
mapped mapped to the DWN action).
* winsup/cygwin/fhandler.h (class dev_console): New boolean
data member, eat_newline. This indicates that if a character
is output which moves down to the next line, it should be
discarded rather than sent to the console.
* winsup/cygwin/fhandler_console.cc
(fhandler_console::write_normal): Set the eat_newline flag
if the text output ends up at column zero. Honor the
eat_newline flag when processing a DWN character, and clear
it when processing certain other control characters.
Diffstat (limited to 'winsup/cygwin/fhandler.h')
-rw-r--r-- | winsup/cygwin/fhandler.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 4da35b7f5..53798d047 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -2020,6 +2020,7 @@ class dev_console bool iso_2022_G1; bool alternate_charset_active; bool metabit; + bool eat_newline; char backspace_keycode; bool screen_alternated; /* For xterm compatible mode only */ |