From 29b62b186d6939752fd11b6193ebfabac7527878 Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 14 Jan 2007 01:56:23 +0000 Subject: [PATCH] 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 --- edit.c | 35 +++++++++-------------------------- mksh.1 | 3 +-- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/edit.c b/edit.c index b1494c7..4e27dcd 100644 --- a/edit.c +++ b/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; } diff --git a/mksh.1 b/mksh.1 index 7dba95d..0ef65a6 100644 --- a/mksh.1 +++ b/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 ^[^]