mirror of
https://github.com/rfivet/uemacs.git
synced 2024-06-10 05:50:42 +00:00
Fix terminal resizing when new postion of last modeline overlap top row of last window.
This commit is contained in:
parent
f010d63a95
commit
f96ace997f
|
@ -1327,6 +1327,12 @@ static void sizesignal( int signr) {
|
||||||
static void newscreensize( int h, int w) {
|
static void newscreensize( int h, int w) {
|
||||||
chg_width = chg_height = 0 ;
|
chg_width = chg_height = 0 ;
|
||||||
vtfree() ;
|
vtfree() ;
|
||||||
|
if( h < 3)
|
||||||
|
h = 3 ;
|
||||||
|
|
||||||
|
if( w < 10)
|
||||||
|
w = 10 ;
|
||||||
|
|
||||||
vtalloc( h, w) ;
|
vtalloc( h, w) ;
|
||||||
if( h <= term.t_mrow)
|
if( h <= term.t_mrow)
|
||||||
newsize( TRUE, h) ;
|
newsize( TRUE, h) ;
|
||||||
|
|
2
names.c
2
names.c
|
@ -50,7 +50,7 @@ const name_bind names[] = {
|
||||||
{"!case-word-lower", lowerword, META | 'L'} ,
|
{"!case-word-lower", lowerword, META | 'L'} ,
|
||||||
{"!case-word-upper", upperword, META | 'U'} ,
|
{"!case-word-upper", upperword, META | 'U'} ,
|
||||||
{" change-file-name", filename, CTLX | 'N'} ,
|
{" change-file-name", filename, CTLX | 'N'} ,
|
||||||
{" change-screen-size", newsize, META | CTL_ | 'D'} , /* M^S */
|
{" change-screen-size", (fnp_t) newsize, META | CTL_ | 'D'} , /* M^S */
|
||||||
{" change-screen-width", (fnp_t) newwidth, META | CTL_ | 'T'} ,
|
{" change-screen-width", (fnp_t) newwidth, META | CTL_ | 'T'} ,
|
||||||
{" clear-and-redraw", (fnp_t) redraw, CTL_ | 'L'} ,
|
{" clear-and-redraw", (fnp_t) redraw, CTL_ | 'L'} ,
|
||||||
{" clear-message-line", (fnp_t) clrmes, 0} ,
|
{" clear-message-line", (fnp_t) clrmes, 0} ,
|
||||||
|
|
94
window.c
94
window.c
|
@ -566,84 +566,80 @@ BINDABLE( restwnd) {
|
||||||
* int f; default flag
|
* int f; default flag
|
||||||
* int n; numeric argument
|
* int n; numeric argument
|
||||||
*/
|
*/
|
||||||
BINDABLE( newsize) {
|
BBINDABLE( newsize) {
|
||||||
window_p wp; /* current window being examined */
|
window_p wp ; /* current window being examined */
|
||||||
window_p nextwp; /* next window to scan */
|
|
||||||
window_p lastwp; /* last window scanned */
|
|
||||||
int lastline; /* screen line of last line of current window */
|
|
||||||
|
|
||||||
/* if the command defaults, assume the largest */
|
/* if the command defaults, assume the largest */
|
||||||
if (f == FALSE)
|
if( f == FALSE)
|
||||||
n = term.t_mrow ;
|
n = term.t_mrow ;
|
||||||
|
|
||||||
/* make sure it's in range */
|
/* make sure it's in range */
|
||||||
if( n < 3 || n > term.t_mrow)
|
if( n < 3 || n > term.t_mrow)
|
||||||
return mloutfail( "%%Screen size out of range") ;
|
return mloutfail( "%%Screen size out of range") ;
|
||||||
|
|
||||||
if (term.t_nrow == n - 1)
|
if( term.t_nrow == n - 1)
|
||||||
return TRUE;
|
/* no change */
|
||||||
else if (term.t_nrow < n - 1) {
|
return TRUE ;
|
||||||
|
else if( term.t_nrow < n - 1) {
|
||||||
|
/* new size is bigger */
|
||||||
/* go to the last window */
|
/* go to the last window */
|
||||||
wp = wheadp;
|
for( wp = wheadp ; wp->w_wndp != NULL ; wp = wp->w_wndp)
|
||||||
while (wp->w_wndp != NULL)
|
;
|
||||||
wp = wp->w_wndp;
|
|
||||||
|
|
||||||
/* and enlarge it as needed */
|
/* and enlarge it as needed */
|
||||||
wp->w_ntrows = n - wp->w_toprow - 2;
|
wp->w_ntrows = n - wp->w_toprow - 2 ;
|
||||||
wp->w_flag |= WFHARD | WFMODE;
|
wp->w_flag |= WFHARD | WFMODE ;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
/* new size is smaller */
|
||||||
/* rebuild the window structure */
|
/* rebuild the window structure */
|
||||||
assert( wheadp->w_toprow == 0) ; /* proves coverity wrong */
|
assert( wheadp->w_toprow == 0) ; /* proves coverity wrong */
|
||||||
nextwp = wheadp;
|
window_p lastwp = NULL ;
|
||||||
wp = NULL;
|
for( window_p nextwp = wheadp ; nextwp != NULL ; ) {
|
||||||
lastwp = NULL;
|
wp = nextwp ;
|
||||||
while (nextwp != NULL) {
|
nextwp = wp->w_wndp ;
|
||||||
wp = nextwp;
|
|
||||||
nextwp = wp->w_wndp;
|
if( wp->w_toprow == n - 2) {
|
||||||
|
lastwp->w_ntrows = n - lastwp->w_toprow - 2 ;
|
||||||
|
lastwp->w_flag |= WFHARD | WFMODE ;
|
||||||
|
}
|
||||||
|
|
||||||
/* get rid of it if it is too low */
|
/* get rid of it if it is too low */
|
||||||
if (wp->w_toprow > n - 2) {
|
if( wp->w_toprow >= n - 2) {
|
||||||
|
|
||||||
/* save the point/mark if needed */
|
/* save the point/mark if needed */
|
||||||
if (--wp->w_bufp->b_nwnd == 0) {
|
if( --wp->w_bufp->b_nwnd == 0) {
|
||||||
wp->w_bufp->b_dotp = wp->w_dotp;
|
wp->w_bufp->b_dotp = wp->w_dotp ;
|
||||||
wp->w_bufp->b_doto = wp->w_doto;
|
wp->w_bufp->b_doto = wp->w_doto ;
|
||||||
wp->w_bufp->b_markp = wp->w_markp;
|
wp->w_bufp->b_markp = wp->w_markp ;
|
||||||
wp->w_bufp->b_marko = wp->w_marko;
|
wp->w_bufp->b_marko = wp->w_marko ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update curwp and lastwp if needed */
|
/* update curwp and lastwp if needed */
|
||||||
if (wp == curwp)
|
if( wp == curwp) {
|
||||||
curwp = wheadp;
|
curwp = wheadp ;
|
||||||
curbp = curwp->w_bufp;
|
curbp = curwp->w_bufp ;
|
||||||
if (lastwp != NULL)
|
}
|
||||||
lastwp->w_wndp = NULL;
|
|
||||||
|
|
||||||
/* free the structure */
|
/* free the structure */
|
||||||
free((char *) wp);
|
free( wp) ;
|
||||||
wp = NULL;
|
lastwp->w_wndp = NULL ;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* need to change this window size? */
|
/* need to change this window size? */
|
||||||
lastline = wp->w_toprow + wp->w_ntrows - 1;
|
int lastline = wp->w_toprow + wp->w_ntrows - 1 ;
|
||||||
if (lastline >= n - 2) {
|
if( lastline >= n - 2) {
|
||||||
wp->w_ntrows =
|
wp->w_ntrows = n - wp->w_toprow - 2 ;
|
||||||
n - wp->w_toprow - 2;
|
assert( wp->w_ntrows) ;
|
||||||
wp->w_flag |= WFHARD | WFMODE;
|
wp->w_flag |= WFHARD | WFMODE ;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
lastwp = wp;
|
lastwp = wp ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* screen is garbage */
|
/* screen is garbage */
|
||||||
term.t_nrow = n - 1;
|
term.t_nrow = n - 1 ;
|
||||||
sgarbf = TRUE;
|
sgarbf = TRUE ;
|
||||||
return TRUE;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
window.h
2
window.h
|
@ -55,7 +55,7 @@ extern window_p wheadp ; /* Head of list of windows */
|
||||||
BINDABLE( enlargewind) ;
|
BINDABLE( enlargewind) ;
|
||||||
BINDABLE( mvdnwind) ;
|
BINDABLE( mvdnwind) ;
|
||||||
BINDABLE( mvupwind) ;
|
BINDABLE( mvupwind) ;
|
||||||
BINDABLE( newsize) ;
|
BBINDABLE( newsize) ;
|
||||||
BBINDABLE( newwidth) ;
|
BBINDABLE( newwidth) ;
|
||||||
BINDABLE( nextwind) ;
|
BINDABLE( nextwind) ;
|
||||||
BINDABLE( onlywind) ;
|
BINDABLE( onlywind) ;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user