mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Cleanup virtual terminal allocation code.
This commit is contained in:
parent
57363dcb19
commit
b6c89d6eca
18
display.c
18
display.c
@ -39,7 +39,7 @@ struct video {
|
||||
int v_rfcolor; /* requested forground color */
|
||||
int v_rbcolor; /* requested background color */
|
||||
#endif
|
||||
unicode_t v_text[1]; /* Screen data. */
|
||||
unicode_t v_text[] ; /* Screen data. */
|
||||
};
|
||||
|
||||
#define VFCHG 0x0001 /* Changed flag */
|
||||
@ -109,13 +109,13 @@ void vtinit(void)
|
||||
TTopen(); /* open the screen */
|
||||
TTkopen(); /* open the keyboard */
|
||||
TTrev(FALSE);
|
||||
vscreen = xmalloc( MAXROW * sizeof( struct video *)) ;
|
||||
vscreen = xmalloc( term.t_maxrow * sizeof( struct video *)) ;
|
||||
|
||||
#if MEMMAP == 0 || SCROLLCODE
|
||||
pscreen = xmalloc( MAXROW * sizeof( struct video *)) ;
|
||||
pscreen = xmalloc( term.t_maxrow * sizeof( struct video *)) ;
|
||||
#endif
|
||||
for( i = 0 ; i < MAXROW ; ++i) {
|
||||
vp = xmalloc( sizeof( struct video) + MAXCOL * 4) ;
|
||||
for( i = 0 ; i < term.t_maxrow ; ++i) {
|
||||
vp = xmalloc( sizeof( struct video) + term.t_maxcol * sizeof( unicode_t)) ;
|
||||
vp->v_flag = 0;
|
||||
#if COLOR
|
||||
vp->v_rfcolor = 7;
|
||||
@ -123,7 +123,7 @@ void vtinit(void)
|
||||
#endif
|
||||
vscreen[i] = vp;
|
||||
#if MEMMAP == 0 || SCROLLCODE
|
||||
vp = xmalloc( sizeof( struct video) + MAXCOL * 4 ) ;
|
||||
vp = xmalloc( sizeof( struct video) + term.t_maxcol * sizeof( unicode_t)) ;
|
||||
vp->v_flag = 0;
|
||||
pscreen[i] = vp;
|
||||
#endif
|
||||
@ -136,7 +136,7 @@ void vtinit(void)
|
||||
void vtfree(void)
|
||||
{
|
||||
int i;
|
||||
for( i = 0 ; i < MAXROW; ++i ) {
|
||||
for( i = 0 ; i < term.t_maxrow; ++i ) {
|
||||
free(vscreen[i]);
|
||||
#if MEMMAP == 0 || SCROLLCODE
|
||||
free(pscreen[i]);
|
||||
@ -1521,8 +1521,8 @@ void sizesignal(int signr)
|
||||
getscreensize(&w, &h);
|
||||
|
||||
if( h > 0 && w > 0) {
|
||||
term.t_mrow = h = h < MAXROW ? h : MAXROW ;
|
||||
term.t_mcol = w = w < MAXCOL ? w : MAXCOL ;
|
||||
term.t_mrow = h = h < term.t_maxrow ? h : term.t_maxrow ;
|
||||
term.t_mcol = w = w < term.t_maxcol ? w : term.t_maxcol ;
|
||||
if( h - 1 != term.t_nrow || w != term.t_ncol)
|
||||
newscreensize( h, w) ;
|
||||
}
|
||||
|
10
tcap.c
10
tcap.c
@ -88,7 +88,9 @@ static char *CS, *DL, *AL, *SF, *SR;
|
||||
#endif
|
||||
|
||||
struct terminal term = {
|
||||
0, /* These four values are set dynamically at open time. */
|
||||
210, /* actual 204 on 1920x1080 landscape terminal window */
|
||||
500, /* actual 475 */
|
||||
0, /* These four values are set dynamically at open time. */
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@ -157,11 +159,11 @@ static void tcapopen(void)
|
||||
exit( EXIT_FAILURE) ;
|
||||
}
|
||||
|
||||
term.t_mrow = int_row < MAXROW ? int_row : MAXROW ;
|
||||
term.t_mrow = int_row < term.t_maxrow ? int_row : term.t_maxrow ;
|
||||
term.t_nrow = term.t_mrow - 1 ;
|
||||
term.t_mcol = int_col < MAXCOL ? int_col : MAXCOL ;
|
||||
term.t_mcol = int_col < term.t_maxcol ? int_col : term.t_maxcol ;
|
||||
term.t_ncol = term.t_mcol ;
|
||||
|
||||
|
||||
p = tcapbuf;
|
||||
t = tgetstr("pc", &p);
|
||||
if (t)
|
||||
|
16
terminal.h
16
terminal.h
@ -7,12 +7,6 @@
|
||||
#include "utf8.h"
|
||||
|
||||
|
||||
/* Actual 471x175 on a 1920x1080 screen in landscape,
|
||||
if smaller font or portrait orientation limit to 500x200 */
|
||||
#define MAXCOL 500
|
||||
#define MAXROW 200
|
||||
|
||||
|
||||
/*
|
||||
* The editor communicates with the display using a high level interface. A
|
||||
* "TERM" structure holds useful variables, and indirect pointers to routines
|
||||
@ -23,10 +17,12 @@
|
||||
* one terminal type.
|
||||
*/
|
||||
struct terminal {
|
||||
short t_mrow; /* max number of rows allowable */
|
||||
short t_nrow; /* current number of rows used */
|
||||
short t_mcol; /* max Number of columns. */
|
||||
short t_ncol; /* current Number of columns. */
|
||||
const short t_maxrow ; /* max number of rows allowable */
|
||||
const short t_maxcol ; /* max number of columns allowable */
|
||||
short t_mrow ; /* max number of rows displayable */
|
||||
short t_nrow ; /* current number of rows displayed */
|
||||
short t_mcol ; /* max number of rows displayable */
|
||||
short t_ncol ; /* current number of columns displayed */
|
||||
short t_margin; /* min margin for extended lines */
|
||||
short t_scrsiz; /* size of scroll region " */
|
||||
int t_pause; /* # times thru update to pause */
|
||||
|
Loading…
Reference in New Issue
Block a user