diff options
author | Christopher Faylor <me@cgf.cx> | 2001-05-09 18:53:55 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-05-09 18:53:55 +0000 |
commit | cd94b71c1b254eb9f2d0ef8cfe99f100430cd86a (patch) | |
tree | d9c86d049e6ff03e06d70ae751986617c293a9b5 /winsup/cygwin/fhandler_termios.cc | |
parent | 00b59ce9c9eab2d1e6d4ff89807b5afd70d13a6f (diff) | |
download | cygnal-cd94b71c1b254eb9f2d0ef8cfe99f100430cd86a.tar.gz cygnal-cd94b71c1b254eb9f2d0ef8cfe99f100430cd86a.tar.bz2 cygnal-cd94b71c1b254eb9f2d0ef8cfe99f100430cd86a.zip |
* fhandler.h (fhandler_termios::echo_erase): Declare new method.
* fhandler_termios.cc (fhandler_termios::echo_erase): New method for echoing
erase characters.
(fhandler_termios::line_edit): Check the echo flag before echoing control
characters (from Kazuhiro Fujieda <fujieda@jaist.ac.jp>).
Diffstat (limited to 'winsup/cygwin/fhandler_termios.cc')
-rw-r--r-- | winsup/cygwin/fhandler_termios.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index 058410d9d..6082c2b6d 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -17,6 +17,7 @@ details. */ #include "cygerrno.h" #include "fhandler.h" #include "sync.h" +#include "interlock.h" #include "sigproc.h" #include "pinfo.h" #include "tty.h" @@ -160,6 +161,13 @@ setEIO: #define set_input_done(x) input_done = input_done || (x) +inline void +fhandler_termios::echo_erase (int force) +{ + if (force || tc->ti.c_lflag & ECHO) + doecho ("\b \b", 3); +} + int fhandler_termios::line_edit (const char *rptr, int nread, int always_accept) { @@ -247,7 +255,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept) else if (c == tc->ti.c_cc[VERASE]) { if (eat_readahead (1)) - doecho ("\b \b", 3); + echo_erase (); continue; } else if (c == tc->ti.c_cc[VWERASE]) @@ -257,21 +265,25 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept) if (!eat_readahead (1)) break; else - doecho ("\b \b", 3); + echo_erase (); while ((ch = peek_readahead (1)) >= 0 && !isspace (ch)); continue; } else if (c == tc->ti.c_cc[VKILL]) { int nchars = eat_readahead (-1); - while (nchars--) - doecho ("\b \b", 3); + if (tc->ti.c_lflag & ECHO) + while (nchars--) + echo_erase (1); continue; } else if (c == tc->ti.c_cc[VREPRINT]) { - doecho ("\n\r", 2); - doecho (rabuf, ralen); + if (tc->ti.c_lflag & ECHO) + { + doecho ("\n\r", 2); + doecho (rabuf, ralen); + } continue; } else if (c == tc->ti.c_cc[VEOF]) |