* do *not* check the terminal size after each line processing,

only if we got a SIGWINCH -> interactive use speed-up on the
  slower boxen (slowness courtesy of otto@obsd)
* ^L (redraw line) now (always) checks window size; use this
  instead if required while editing the prompt; changes to the
  variables will still be propagated after the line is entered
This commit is contained in:
tg 2007-01-14 01:09:09 +00:00
parent 87f681b488
commit 36e761840e
2 changed files with 7 additions and 5 deletions

7
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.76 2007/01/12 10:18:20 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.77 2007/01/14 01:09:08 tg Exp $");
/* tty driver characters we are interested in */ /* tty driver characters we are interested in */
typedef struct { typedef struct {
@ -129,7 +129,8 @@ x_read(char *buf, size_t len)
i = -1; /* internal error */ i = -1; /* internal error */
x_mode(false); x_mode(false);
#if defined(TIOCGWINSZ) && defined(SIGWINCH) #if defined(TIOCGWINSZ) && defined(SIGWINCH)
check_sigwinch(); if (got_sigwinch)
check_sigwinch();
#endif #endif
return i; return i;
} }
@ -2235,9 +2236,9 @@ x_mv_begin(int c __unused)
static int static int
x_draw_line(int c __unused) x_draw_line(int c __unused)
{ {
check_sigwinch();
x_redraw(-1); x_redraw(-1);
return KSTD; return KSTD;
} }
/* Redraw (part of) the line. If limit is < 0, the everything is redrawn /* Redraw (part of) the line. If limit is < 0, the everything is redrawn

5
mksh.1
View File

@ -1,7 +1,7 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.73 2007/01/06 18:48:26 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.74 2007/01/14 01:09:09 tg Exp $
.\" $OpenBSD: ksh.1,v 1.118 2006/11/30 08:47:58 jmc Exp $ .\" $OpenBSD: ksh.1,v 1.118 2006/11/30 08:47:58 jmc Exp $
.\" .\"
.Dd January 6, 2007 .Dd January 14, 2007
.Dt MKSH 1 .Dt MKSH 1
.Os MirBSD .Os MirBSD
.Sh NAME .Sh NAME
@ -4553,6 +4553,7 @@ word of the previous command is inserted at the cursor.
The following character is taken literally rather than as an editing command. The following character is taken literally rather than as an editing command.
.It redraw: ^L .It redraw: ^L
Reprints the last line of the prompt string and the current input line. Reprints the last line of the prompt string and the current input line.
Also checks terminal size (columns and lines) as reported by stty for changes.
.It Xo search-character-backward: .It Xo search-character-backward:
.Op Ar n .Op Ar n
.No ^[^] .No ^[^]