Skip to content

Commit

Permalink
[v1.1] emacs: remove annoying paper terminal feature for ^U (kill)
Browse files Browse the repository at this point in the history
Quoth the manual:

>      kill      (User defined kill character as defined by the
>                stty(1) command, usually ^U.) Kill the entire
>                current line.  If two kill characters are entered
>                in succession, all kill characters from then on
>                cause a line feed (useful when using paper
>                terminals).  A subsequent pair of kill characters
>                undoes this change.

That latter feature has annoyed me long enough. It's too common to
press ^U twice accidentally. Also, paper terminals? I didn't know
ksh93 existed in the 1970s :-)
  • Loading branch information
McDutchie committed Jul 22, 2024
1 parent 6df4888 commit 2c069af
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 35 deletions.
3 changes: 3 additions & 0 deletions ANNOUNCE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ New command line editor features:
The arrow-up and arrow-down keys now act like PageUp and PageDown, unless
the new --arrowkeysearch option is turned off (see below).

- In the emacs line editor, pressing ^U (kill) twice no longer causes further
^U presses to start a new line (this was a feature for paper terminals).

New shell language features:

- The 'time' reserved word now outputs timings in a precision of 3 digits
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library.
corresponding closing parentheses and enclosed within a compound command
failed to throw a syntax error and could cause the shell to crash.

- [v1.1] In emacs mode, pressing ^U (kill) twice no longer causes further
^U presses to start a new line (this was a feature for paper terminals).

2024-07-20:

- Fixed a regression where a broken pipe signal (SIGPIPE), when occurring in
Expand Down
27 changes: 0 additions & 27 deletions src/cmd/ksh93/edit/emacs.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ typedef struct _emacs_
char lastdraw; /* last update type */
int offset; /* Screen offset */
char ehist; /* hist handling required */
enum
{
CRT=0, /* Crt terminal */
PAPER /* Paper terminal */
} terminal;
Histloc_t _location;
int prevdirection;
Edit_t *ed; /* pointer to edit data */
Expand Down Expand Up @@ -594,28 +589,6 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
#endif /* ESH_KAPPEND */
out[i] = 0;
draw(ep,UPDATE);
if (c == KILLCHAR)
{
if (ep->terminal == PAPER)
{
putchar(ep->ed,'\n');
ed_putstring(ep->ed,Prompt);
}
c = ed_getchar(ep->ed,0);
if (c != usrkill)
{
ed_ungetchar(ep->ed,c);
continue;
}
if (ep->terminal == PAPER)
ep->terminal = CRT;
else
{
ep->terminal = PAPER;
putchar(ep->ed,'\n');
ed_putstring(ep->ed,Prompt);
}
}
continue;
case cntl('L'):
putchar(ep->ed,'\n');
Expand Down
8 changes: 0 additions & 8 deletions src/cmd/ksh93/sh.1
Original file line number Diff line number Diff line change
Expand Up @@ -5322,14 +5322,6 @@ by the
command, usually
.BR ^U .)
Kill the entire current line.
If two
.I kill
characters are entered in succession, all
kill characters from then on cause a line feed
(useful when using paper terminals).
A subsequent pair of
.I kill
characters undoes this change.
.TP 10
.BI ^Y
Restore last item removed from line. (Yank item back to the line.)
Expand Down

0 comments on commit 2c069af

Please sign in to comment.