okay, this didn't work out; changing window sizes when we're
actually within a (the emacs) editing mode does not work at all, whether forced or not, only if we leave the editing mode (at end of input); probably due to it saving stuff from e.g. x_cols into xx_cols, etc. -> remove SIGWINCH handling(!) -> TIOCGWINSZ is now executed at end of every input line -> use 'ESC #' if you direly need to change line size
This commit is contained in:
parent
36e761840e
commit
29b62b186d
35
edit.c
35
edit.c
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.77 2007/01/14 01:09:08 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.78 2007/01/14 01:56:23 tg Exp $");
|
||||
|
||||
/* tty driver characters we are interested in */
|
||||
typedef struct {
|
||||
|
@ -41,10 +41,8 @@ int x_emacs(char *, size_t);
|
|||
void x_init_emacs(void);
|
||||
int x_vi(char *, size_t);
|
||||
|
||||
#if defined(TIOCGWINSZ) && defined(SIGWINCH)
|
||||
static void x_sigwinch(int);
|
||||
static volatile sig_atomic_t got_sigwinch;
|
||||
static void check_sigwinch(void);
|
||||
#ifdef TIOCGWINSZ
|
||||
static void chkwinsz(void);
|
||||
#endif
|
||||
|
||||
static int path_order_cmp(const void *aa, const void *bb);
|
||||
|
@ -66,31 +64,18 @@ x_init(void)
|
|||
edchars.eof = -2;
|
||||
/* default value for deficient systems */
|
||||
edchars.werase = 027; /* ^W */
|
||||
|
||||
#if defined(TIOCGWINSZ) && defined(SIGWINCH)
|
||||
if (setsig(&sigtraps[SIGWINCH], x_sigwinch,
|
||||
SS_RESTORE_ORIG | SS_SHTRAP))
|
||||
sigtraps[SIGWINCH].flags |= TF_SHELL_USES;
|
||||
check_sigwinch(); /* force initial check */
|
||||
#ifdef TIOCGWINSZ
|
||||
chkwinsz();
|
||||
#endif
|
||||
|
||||
x_init_emacs();
|
||||
}
|
||||
|
||||
#if defined(TIOCGWINSZ) && defined(SIGWINCH)
|
||||
/* ARGSUSED */
|
||||
#ifdef TIOCGWINSZ
|
||||
static void
|
||||
x_sigwinch(int sig __unused)
|
||||
{
|
||||
got_sigwinch = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
check_sigwinch(void)
|
||||
chkwinsz(void)
|
||||
{
|
||||
struct winsize ws;
|
||||
|
||||
got_sigwinch = 0;
|
||||
if (procpid == kshpid && ioctl(tty_fd, TIOCGWINSZ, &ws) >= 0) {
|
||||
struct tbl *vp;
|
||||
|
||||
|
@ -128,9 +113,8 @@ x_read(char *buf, size_t len)
|
|||
else
|
||||
i = -1; /* internal error */
|
||||
x_mode(false);
|
||||
#if defined(TIOCGWINSZ) && defined(SIGWINCH)
|
||||
if (got_sigwinch)
|
||||
check_sigwinch();
|
||||
#ifdef TIOCGWINSZ
|
||||
chkwinsz();
|
||||
#endif
|
||||
return i;
|
||||
}
|
||||
|
@ -2236,7 +2220,6 @@ x_mv_begin(int c __unused)
|
|||
static int
|
||||
x_draw_line(int c __unused)
|
||||
{
|
||||
check_sigwinch();
|
||||
x_redraw(-1);
|
||||
return KSTD;
|
||||
}
|
||||
|
|
3
mksh.1
3
mksh.1
|
@ -1,4 +1,4 @@
|
|||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.74 2007/01/14 01:09:09 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.75 2007/01/14 01:56:23 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.118 2006/11/30 08:47:58 jmc Exp $
|
||||
.\"
|
||||
.Dd January 14, 2007
|
||||
|
@ -4553,7 +4553,6 @@ word of the previous command is inserted at the cursor.
|
|||
The following character is taken literally rather than as an editing command.
|
||||
.It redraw: ^L
|
||||
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:
|
||||
.Op Ar n
|
||||
.No ^[^]
|
||||
|
|
Loading…
Reference in New Issue