On Mon, Apr 01 2019, Jeremie Courreges-Anglas <[email protected]> wrote:
> On Mon, Jun 18 2018, "Todd C. Miller" <[email protected]> wrote:
>> On Sun, 17 Jun 2018 15:52:34 -0600, "Todd C. Miller" wrote:
>>
>>> On Sun, 17 Jun 2018 17:29:31 +0200, Mark Kettenis wrote:
>>>
>>> > If folks indeed think that this is a must-have feature, this is
>>> > certainly a better approach. I wonder though if the setupterm() call
>>> > should happen earlier when interactive mode is initialized?
>>>
>>> This turns out to be simpler than expected. Now whenever TERM is
>>> set (including at startup) it will call setupterm().
>>
>> Hopefully final diff that better handles unknown term types. Now
>> if you set TERM=gobbledegook the old cur_term will be invalidated
>> and clear-screen will not try to the escape sequence for the old
>> terminal.
>>
>> I think this is good enough to commit.
>
> Since this went in, I'm using it on my machines instead of a bind -m hack.
>
> Can't we make ^L=clear-screen the default behavior? I don't see
> discussions about that.
So here's a diff. oks/nays?
NB: regress needs to be handled, as mentioned by Anton. For now I think
I'll comment out the ^L test, not sure how to amend it.
Index: emacs.c
===================================================================
RCS file: /cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.85
diff -u -p -r1.85 emacs.c
--- emacs.c 18 Jun 2018 17:03:58 -0000 1.85
+++ emacs.c 2 Apr 2019 08:43:28 -0000
@@ -1529,7 +1529,7 @@ x_init_emacs(void)
kb_add(x_prev_histword, CTRL('['), '_', 0);
/* how to handle: quote: ^^ */
kb_add(x_literal, CTRL('^'), 0);
- kb_add(x_draw_line, CTRL('L'), 0);
+ kb_add(x_clear_screen, CTRL('L'), 0);
kb_add(x_search_char_back, CTRL('['), CTRL(']'), 0);
kb_add(x_search_char_forw, CTRL(']'), 0);
kb_add(x_search_hist, CTRL('R'), 0);
Index: ksh.1
===================================================================
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.202
diff -u -p -r1.202 ksh.1
--- ksh.1 16 Dec 2018 13:08:35 -0000 1.202
+++ ksh.1 2 Apr 2019 08:43:28 -0000
@@ -4694,7 +4694,7 @@ Moves the cursor to the beginning of the
Uppercase the first character in the next
.Ar n
words, leaving the cursor past the end of the last word.
-.It clear-screen:
+.It clear-screen: ^L
Clears the screen if the
.Ev TERM
parameter is set and the terminal supports clearing the screen, then
@@ -4891,7 +4891,7 @@ The last
word of the previous command is inserted at the cursor.
.It quote: ^^
The following character is taken literally rather than as an editing command.
-.It redraw: ^L
+.It redraw:
Reprints the prompt string and the current input line.
.It Xo search-character-backward:
.Op Ar n
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE