Handle DEL consistently in display and input.

This commit is contained in:
Renaud 2019-08-08 10:55:17 +08:00
parent 3e12643077
commit 08b75d677e
2 changed files with 4 additions and 9 deletions

View File

@ -217,18 +217,12 @@ static void vtputc(int c)
return ;
}
if (c < 0x20) {
if (c < 0x20 || c == 0x7F) {
vtputc('^');
vtputc(c ^ 0x40);
return;
}
if (c == 0x7f) {
vtputc('^');
vtputc('?');
return;
}
if (c >= 0x80 && c <= 0xA0) {
static const char hex[] = "0123456789abcdef";
vtputc('\\');

View File

@ -509,7 +509,7 @@ static void echov( int c) {
if( c == '\n') /* put out <NL> for <ret> */
echos( "<NL>") ;
else {
if( c < ' ') {
if( c < ' ' || c == 0x7F) {
echoc( '^') ;
c ^= 0x40 ;
}
@ -520,7 +520,8 @@ static void echov( int c) {
static void rubc( char c) {
rubout() ;
if( c < ' ') {
if( c < ' ' || c == 0x7F) {
/* ^x range */
rubout() ;
if( c == '\n') {
rubout() ;