I move my windows around and even resize them sometimes. Sometimes
ksh catches on, but a lot of the time it doesn't. The problem is if
I'm running an editor like vi (kinda common reason why I'd want to
resize the terminal), sigwinch doesn't get to ksh. Then when I exit
the editor, command line editing is all messed.
Fix is simple. Pretend we got a sigwinch whenever we do the regular
mailcheck/jobs notify stuff. Then the edit code will check the
current status.
Index: edit.c
===================================================================
RCS file: /cvs/src/bin/ksh/edit.c,v
retrieving revision 1.34
diff -u -p -r1.34 edit.c
--- edit.c 20 May 2010 01:13:07 -0000 1.34
+++ edit.c 4 Sep 2012 22:08:30 -0000
@@ -20,7 +20,7 @@
static void x_sigwinch(int);
-static volatile sig_atomic_t got_sigwinch;
+volatile sig_atomic_t got_sigwinch;
static void check_sigwinch(void);
static int x_file_glob(int, const char *, int, char ***);
Index: main.c
===================================================================
RCS file: /cvs/src/bin/ksh/main.c,v
retrieving revision 1.47
diff -u -p -r1.47 main.c
--- main.c 7 Sep 2011 11:33:25 -0000 1.47
+++ main.c 4 Sep 2012 22:10:29 -0000
@@ -544,6 +544,7 @@ shell(Source *volatile s, volatile int t
}
if (interactive) {
+ got_sigwinch = 1;
j_notify();
mcheck();
set_prompt(PS1, s);
Index: sh.h
===================================================================
RCS file: /cvs/src/bin/ksh/sh.h,v
retrieving revision 1.30
diff -u -p -r1.30 sh.h
--- sh.h 4 Jan 2010 18:07:11 -0000 1.30
+++ sh.h 4 Sep 2012 22:09:55 -0000
@@ -287,6 +287,7 @@ typedef struct trap {
EXTERN volatile sig_atomic_t trap; /* traps pending? */
EXTERN volatile sig_atomic_t intrsig; /* pending trap interrupts command */
EXTERN volatile sig_atomic_t fatal_trap;/* received a fatal signal */
+extern volatile sig_atomic_t got_sigwinch;
extern Trap sigtraps[NSIG+1];
/*