From 923d7bdc8ece9a92d1461948cdd24725b64281e7 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Fri, 2 Jan 2015 17:50:31 +0800 Subject: [PATCH] Insure resizing screen commands are aligned with OS window sizes. --- Makefile | 7 +++---- display.c | 12 ++++++++---- tcap.c | 4 ++-- window.c | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index ffffdee..0b8894c 100644 --- a/Makefile +++ b/Makefile @@ -161,8 +161,7 @@ isearch.o: isearch.c isearch.h basic.h buffer.h crypt.h line.h utf8.h \ defines.h window.h line.o: line.c line.h utf8.h buffer.h crypt.h estruct.h log.h retcode.h \ window.h defines.h -lock.o: lock.c estruct.h lock.h defines.h display.h input.h bind.h \ - retcode.h pklock.h +lock.o: lock.c estruct.h lock.h log.o: log.c log.h retcode.h main.o: main.c estruct.h basic.h bind.h bindable.h buffer.h crypt.h \ line.h utf8.h display.h eval.h execute.h file.h retcode.h input.h lock.h \ @@ -172,7 +171,7 @@ names.o: names.c names.h basic.h bind.h bindable.h buffer.h crypt.h \ line.h utf8.h display.h eval.h exec.h retcode.h file.h isearch.h \ region.h random.h search.h spawn.h window.h defines.h word.h pklock.o: pklock.c estruct.h pklock.h -posix.o: posix.c termio.h estruct.h retcode.h utf8.h +posix.o: posix.c random.o: random.c random.h basic.h buffer.h crypt.h line.h utf8.h \ display.h estruct.h execute.h input.h bind.h log.h retcode.h search.h \ terminal.h defines.h window.h @@ -186,7 +185,7 @@ spawn.o: spawn.c spawn.h defines.h buffer.h crypt.h line.h utf8.h \ terminal.h window.h tcap.o: tcap.c terminal.h defines.h retcode.h display.h estruct.h \ termio.h -termio.o: termio.c +termio.o: termio.c termio.h estruct.h retcode.h utf8.h utf8.o: utf8.c utf8.h vmsvt.o: vmsvt.c estruct.h vt52.o: vt52.c estruct.h diff --git a/display.c b/display.c index d92c820..99e8946 100644 --- a/display.c +++ b/display.c @@ -1550,8 +1550,12 @@ void sizesignal(int signr) getscreensize(&w, &h); - if (h && w && (h - 1 != term.t_nrow || w != term.t_ncol)) - newscreensize(h, w); + if( h && w) { + term.t_mrow = h ; + term.t_mcol = w ; + if( h - 1 != term.t_nrow || w != term.t_ncol) + newscreensize( h, w) ; + } signal(SIGWINCH, sizesignal); errno = old_errno; @@ -1566,9 +1570,9 @@ static int newscreensize(int h, int w) return FALSE; } chg_width = chg_height = 0; - if (h - 1 < term.t_mrow) + if( h <= term.t_mrow) newsize(TRUE, h); - if (w < term.t_mcol) + if( w <= term.t_mcol) newwidth(TRUE, w); update(TRUE); diff --git a/tcap.c b/tcap.c index 911d866..3b62c30 100644 --- a/tcap.c +++ b/tcap.c @@ -161,8 +161,8 @@ static void tcapopen(void) exit(1); } #ifdef SIGWINCH - term.t_mrow = MAXROW; - term.t_mcol = MAXCOL; + term.t_mrow = int_row > MAXROW ? MAXROW : int_row ; + term.t_mcol = int_col > MAXCOL ? MAXCOL : int_col ; #else term.t_mrow = term.t_nrow > MAXROW ? MAXROW : term.t_nrow; term.t_mcol = term.t_ncol > MAXCOL ? MAXCOL : term.t_ncol; diff --git a/window.c b/window.c index f78ccd7..b92881d 100644 --- a/window.c +++ b/window.c @@ -599,10 +599,10 @@ int newsize(int f, int n) /* if the command defaults, assume the largest */ if (f == FALSE) - n = term.t_mrow + 1; + n = term.t_mrow ; /* make sure it's in range */ - if (n < 3 || n > term.t_mrow + 1) { + if (n < 3 || n > term.t_mrow) { mlwrite("%%Screen size out of range"); return FALSE; }