1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-12 23:56:51 -05:00

Fix initialization of screen margin and scroll size.

This commit is contained in:
Renaud 2021-08-30 13:16:46 +08:00
parent 0cb1799786
commit f010d63a95
3 changed files with 11 additions and 5 deletions

View File

@ -135,6 +135,14 @@ static void vtalloc( int maxrow, int maxcol) {
}
}
void updmargin( void) {
term.t_margin = term.t_ncol / 10 ;
if( term.t_margin < 3) /* t_margin - 1 enough for $ + prev before current */
term.t_margin = 3 ;
term.t_scrsiz = term.t_ncol - 2 * term.t_margin ;
}
void vtinit( void) {
#ifdef SIGWINCH
signal( SIGWINCH, sizesignal) ;
@ -142,6 +150,7 @@ void vtinit( void) {
setlocale( LC_CTYPE, "") ; /* expects $LANG like en_GB.UTF-8 */
TTopen() ; /* open the screen */
updmargin() ;
TTkopen() ; /* open the keyboard */
TTrev( FALSE) ;
vtalloc( term.t_mrow, term.t_mcol) ;

View File

@ -25,6 +25,7 @@ void vtinit( void) ;
void vtfree( void) ;
void vttidy( void) ;
void update( boolean force_f) ;
void updmargin( void) ;
void upmode( void) ;
void movecursor( int row, int col) ;
void mlerase( void) ;

View File

@ -663,11 +663,7 @@ BBINDABLE( newwidth) {
/* otherwise, just re-width it (no big deal) */
term.t_ncol = n ;
term.t_margin = n / 10 ;
if( term.t_margin < 3) /* t_margin -1 enough for $ + prev before current */
term.t_margin = 3 ;
term.t_scrsiz = n - (term.t_margin * 2) ;
updmargin() ;
/* force all windows to redraw */
for( window_p wp = wheadp ; wp; wp = wp->w_wndp)