1
0
mirror of https://github.com/rfivet/uemacs.git synced 2025-07-25 19:04:38 -04:00

Insure that virtual terminal is always initialized with maximum size (MAXROW X MAXCOL) while current maximum size is inherited from actual terminal.

This commit is contained in:
Renaud 2017-05-29 16:27:46 +08:00
parent 5d46ffc3dc
commit 35f2184253
2 changed files with 16 additions and 21 deletions

View File

@ -109,13 +109,13 @@ void vtinit(void)
TTopen(); /* open the screen */ TTopen(); /* open the screen */
TTkopen(); /* open the keyboard */ TTkopen(); /* open the keyboard */
TTrev(FALSE); TTrev(FALSE);
vscreen = xmalloc(term.t_mrow * sizeof(struct video *)); vscreen = xmalloc( MAXROW * sizeof( struct video *)) ;
#if MEMMAP == 0 || SCROLLCODE #if MEMMAP == 0 || SCROLLCODE
pscreen = xmalloc(term.t_mrow * sizeof(struct video *)); pscreen = xmalloc( MAXROW * sizeof( struct video *)) ;
#endif #endif
for (i = 0; i < term.t_mrow; ++i) { for( i = 0 ; i < MAXROW ; ++i) {
vp = xmalloc(sizeof(struct video) + term.t_mcol*4); vp = xmalloc( sizeof( struct video) + MAXCOL * 4) ;
vp->v_flag = 0; vp->v_flag = 0;
#if COLOR #if COLOR
vp->v_rfcolor = 7; vp->v_rfcolor = 7;
@ -123,7 +123,7 @@ void vtinit(void)
#endif #endif
vscreen[i] = vp; vscreen[i] = vp;
#if MEMMAP == 0 || SCROLLCODE #if MEMMAP == 0 || SCROLLCODE
vp = xmalloc(sizeof(struct video) + term.t_mcol*4); vp = xmalloc( sizeof( struct video) + MAXCOL * 4 ) ;
vp->v_flag = 0; vp->v_flag = 0;
pscreen[i] = vp; pscreen[i] = vp;
#endif #endif
@ -136,7 +136,7 @@ void vtinit(void)
void vtfree(void) void vtfree(void)
{ {
int i; int i;
for (i = 0; i < term.t_mrow; ++i) { for( i = 0 ; i < MAXROW; ++i ) {
free(vscreen[i]); free(vscreen[i]);
#if MEMMAP == 0 || SCROLLCODE #if MEMMAP == 0 || SCROLLCODE
free(pscreen[i]); free(pscreen[i]);

25
tcap.c
View File

@ -144,30 +144,25 @@ static void tcapopen(void)
} }
/* Get screen size from system, or else from termcap. */ /* Get screen size from system, or else from termcap. */
getscreensize(&int_col, &int_row); getscreensize( &int_col, &int_row) ;
term.t_nrow = int_row - 1; if( (int_row <= 0)
term.t_ncol = int_col; && ((int_row = tgetnum("li")) == -1)) {
if ((term.t_nrow <= 0)
&& (term.t_nrow = (short) tgetnum("li") - 1) == -1) {
fputs( "termcap entry incomplete (lines)\n", stderr) ; fputs( "termcap entry incomplete (lines)\n", stderr) ;
exit( EXIT_FAILURE) ; exit( EXIT_FAILURE) ;
} }
if ((term.t_ncol <= 0) if( (int_col <= 0)
&& (term.t_ncol = (short) tgetnum("co")) == -1) { && ((int_col = tgetnum("co")) == -1)) {
fputs( "Termcap entry incomplete (columns)\n", stderr) ; fputs( "Termcap entry incomplete (columns)\n", stderr) ;
exit( EXIT_FAILURE) ; exit( EXIT_FAILURE) ;
} }
#ifdef SIGWINCH #ifdef SIGWINCH
/* At initialization we use maximum size even if current OS window is smaller */ /* At initialization we use maximum size even if current OS window is smaller */
term.t_mrow = MAXROW ; term.t_mrow = int_row < MAXROW ? int_row : MAXROW ;
term.t_mcol = MAXCOL ; term.t_nrow = term.t_mrow - 1 ;
if( term.t_nrow >= term.t_mrow) term.t_mcol = int_col < MAXCOL ? int_col : MAXCOL ;
term.t_nrow = term.t_mrow - 1 ; term.t_ncol = term.t_mcol ;
if( term.t_ncol > term.t_mcol)
term.t_ncol = term.t_mcol ;
#else #else
term.t_mrow = term.t_nrow > MAXROW ? MAXROW : term.t_nrow; term.t_mrow = term.t_nrow > MAXROW ? MAXROW : term.t_nrow;
term.t_mcol = term.t_ncol > MAXCOL ? MAXCOL : term.t_ncol; term.t_mcol = term.t_ncol > MAXCOL ? MAXCOL : term.t_ncol;