* 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:
		| @@ -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. | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
| @@ -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); | ||||||
|  | 	  if (tc->ti.c_lflag & ECHO) | ||||||
| 	    while (nchars--) | 	    while (nchars--) | ||||||
| 	    doecho ("\b \b", 3); | 	      echo_erase (1); | ||||||
| 	  continue; | 	  continue; | ||||||
| 	} | 	} | ||||||
|       else if (c == tc->ti.c_cc[VREPRINT]) |       else if (c == tc->ti.c_cc[VREPRINT]) | ||||||
|  | 	{ | ||||||
|  | 	  if (tc->ti.c_lflag & ECHO) | ||||||
| 	    { | 	    { | ||||||
| 	      doecho ("\n\r", 2); | 	      doecho ("\n\r", 2); | ||||||
| 	      doecho (rabuf, ralen); | 	      doecho (rabuf, ralen); | ||||||
|  | 	    } | ||||||
| 	  continue; | 	  continue; | ||||||
| 	} | 	} | ||||||
|       else if (c == tc->ti.c_cc[VEOF]) |       else if (c == tc->ti.c_cc[VEOF]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user