* 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>).
This commit is contained in:
Christopher Faylor 2001-05-09 18:53:55 +00:00
parent 00b59ce9c9
commit cd94b71c1b
3 changed files with 27 additions and 6 deletions

View File

@ -1,3 +1,11 @@
Wed May 9 14:46:32 2001 Christopher Faylor <cgf@cygnus.com>
* 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>).
Wed May 9 10:43:30 2001 Christopher Faylor <cgf@cygnus.com> Wed May 9 10:43:30 2001 Christopher Faylor <cgf@cygnus.com>
* include/pthread.h: Remove C++ comment. * include/pthread.h: Remove C++ comment.

View File

@ -600,6 +600,7 @@ public:
virtual void __release_output_mutex (const char *fn, int ln) {} virtual void __release_output_mutex (const char *fn, int ln) {}
void fixup_after_fork (HANDLE); void fixup_after_fork (HANDLE);
void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); } void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); }
void echo_erase (int force = 0);
}; };
enum ansi_intensity enum ansi_intensity

View File

@ -17,6 +17,7 @@ details. */
#include "cygerrno.h" #include "cygerrno.h"
#include "fhandler.h" #include "fhandler.h"
#include "sync.h" #include "sync.h"
#include "interlock.h"
#include "sigproc.h" #include "sigproc.h"
#include "pinfo.h" #include "pinfo.h"
#include "tty.h" #include "tty.h"
@ -160,6 +161,13 @@ setEIO:
#define set_input_done(x) input_done = input_done || (x) #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 int
fhandler_termios::line_edit (const char *rptr, int nread, int always_accept) 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]) else if (c == tc->ti.c_cc[VERASE])
{ {
if (eat_readahead (1)) if (eat_readahead (1))
doecho ("\b \b", 3); echo_erase ();
continue; continue;
} }
else if (c == tc->ti.c_cc[VWERASE]) 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)) if (!eat_readahead (1))
break; break;
else else
doecho ("\b \b", 3); echo_erase ();
while ((ch = peek_readahead (1)) >= 0 && !isspace (ch)); while ((ch = peek_readahead (1)) >= 0 && !isspace (ch));
continue; continue;
} }
else if (c == tc->ti.c_cc[VKILL]) else if (c == tc->ti.c_cc[VKILL])
{ {
int nchars = eat_readahead (-1); int nchars = eat_readahead (-1);
while (nchars--) if (tc->ti.c_lflag & ECHO)
doecho ("\b \b", 3); while (nchars--)
echo_erase (1);
continue; continue;
} }
else if (c == tc->ti.c_cc[VREPRINT]) else if (c == tc->ti.c_cc[VREPRINT])
{ {
doecho ("\n\r", 2); if (tc->ti.c_lflag & ECHO)
doecho (rabuf, ralen); {
doecho ("\n\r", 2);
doecho (rabuf, ralen);
}
continue; continue;
} }
else if (c == tc->ti.c_cc[VEOF]) else if (c == tc->ti.c_cc[VEOF])