Insure resizing screen commands are aligned with OS window sizes.

This commit is contained in:
Renaud 2015-01-02 17:50:31 +08:00
parent c64d4ad381
commit 923d7bdc8e
4 changed files with 15 additions and 12 deletions

View File

@ -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

View File

@ -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);

4
tcap.c
View File

@ -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;

View File

@ -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;
}