mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Compare commits
3 Commits
0a8c28bc07
...
f96ace997f
Author | SHA1 | Date | |
---|---|---|---|
f96ace997f | |||
f010d63a95 | |||
0cb1799786 |
58
display.c
58
display.c
@ -63,7 +63,6 @@ static int curcol ; /* Cursor column */
|
|||||||
static int vtrow = 0 ; /* Row location of SW cursor */
|
static int vtrow = 0 ; /* Row location of SW cursor */
|
||||||
static int vtcol = 0 ; /* Column location of SW cursor */
|
static int vtcol = 0 ; /* Column location of SW cursor */
|
||||||
static int lbound = 0 ; /* leftmost column of current line being displayed */
|
static int lbound = 0 ; /* leftmost column of current line being displayed */
|
||||||
static int taboff = 0 ; /* tab offset for display */
|
|
||||||
|
|
||||||
int mpresf = FALSE ; /* TRUE if message in last line */
|
int mpresf = FALSE ; /* TRUE if message in last line */
|
||||||
int scrollcount = 1 ; /* number of lines to scroll */
|
int scrollcount = 1 ; /* number of lines to scroll */
|
||||||
@ -136,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) {
|
void vtinit( void) {
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
signal( SIGWINCH, sizesignal) ;
|
signal( SIGWINCH, sizesignal) ;
|
||||||
@ -143,6 +150,7 @@ void vtinit( void) {
|
|||||||
|
|
||||||
setlocale( LC_CTYPE, "") ; /* expects $LANG like en_GB.UTF-8 */
|
setlocale( LC_CTYPE, "") ; /* expects $LANG like en_GB.UTF-8 */
|
||||||
TTopen() ; /* open the screen */
|
TTopen() ; /* open the screen */
|
||||||
|
updmargin() ;
|
||||||
TTkopen() ; /* open the keyboard */
|
TTkopen() ; /* open the keyboard */
|
||||||
TTrev( FALSE) ;
|
TTrev( FALSE) ;
|
||||||
vtalloc( term.t_mrow, term.t_mcol) ;
|
vtalloc( term.t_mrow, term.t_mcol) ;
|
||||||
@ -218,7 +226,7 @@ static void vtputuc( unicode_t c) {
|
|||||||
|
|
||||||
if( c == '\t') {
|
if( c == '\t') {
|
||||||
sane_vtputc( viewtab ? 0xBB : ' ') ; /* 0xBB: '»' */
|
sane_vtputc( viewtab ? 0xBB : ' ') ; /* 0xBB: '»' */
|
||||||
while( ((vtcol + taboff) % tabwidth) != 0)
|
while( ((vtcol + lbound) % tabwidth) != 0)
|
||||||
sane_vtputc( ' ') ;
|
sane_vtputc( ' ') ;
|
||||||
} else if( c < 0x20 || c == 0x7F) {
|
} else if( c < 0x20 || c == 0x7F) {
|
||||||
sane_vtputc( '^') ;
|
sane_vtputc( '^') ;
|
||||||
@ -460,6 +468,8 @@ static void show_line( line_p lp) {
|
|||||||
i += utf8_to_unicode( lp->l_text, i, len, &c) ;
|
i += utf8_to_unicode( lp->l_text, i, len, &c) ;
|
||||||
vtputuc( c) ;
|
vtputuc( c) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vteeol() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -469,9 +479,10 @@ static void show_line( line_p lp) {
|
|||||||
* window_p wp; window to update current line in
|
* window_p wp; window to update current line in
|
||||||
*/
|
*/
|
||||||
static void updone( window_p wp) {
|
static void updone( window_p wp) {
|
||||||
|
line_p lp ;
|
||||||
|
|
||||||
/* search down the line we want */
|
/* search down the line we want */
|
||||||
int sline = wp->w_toprow ; /* physical screen line to update */
|
int sline = wp->w_toprow ; /* physical screen line to update */
|
||||||
line_p lp ;
|
|
||||||
for( lp = wp->w_linep ; lp != wp->w_dotp ; lp = lforw( lp))
|
for( lp = wp->w_linep ; lp != wp->w_dotp ; lp = lforw( lp))
|
||||||
++sline ;
|
++sline ;
|
||||||
|
|
||||||
@ -484,7 +495,6 @@ static void updone( window_p wp) {
|
|||||||
vscreen[ sline]->v_rfcolor = wp->w_fcolor ;
|
vscreen[ sline]->v_rfcolor = wp->w_fcolor ;
|
||||||
vscreen[ sline]->v_rbcolor = wp->w_bcolor ;
|
vscreen[ sline]->v_rbcolor = wp->w_bcolor ;
|
||||||
#endif
|
#endif
|
||||||
vteeol() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -506,14 +516,14 @@ static void updall( window_p wp) {
|
|||||||
/* if we are not at the end */
|
/* if we are not at the end */
|
||||||
show_line( lp) ;
|
show_line( lp) ;
|
||||||
lp = lforw( lp) ;
|
lp = lforw( lp) ;
|
||||||
}
|
} else
|
||||||
|
vteeol() ;
|
||||||
|
|
||||||
/* on to the next one */
|
/* on to the next one */
|
||||||
#if COLOR
|
#if COLOR
|
||||||
vscreen[ sline]->v_rfcolor = wp->w_fcolor ;
|
vscreen[ sline]->v_rfcolor = wp->w_fcolor ;
|
||||||
vscreen[ sline]->v_rbcolor = wp->w_bcolor ;
|
vscreen[ sline]->v_rbcolor = wp->w_bcolor ;
|
||||||
#endif
|
#endif
|
||||||
vteeol() ;
|
|
||||||
++sline ;
|
++sline ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,13 +534,12 @@ static void updall( window_p wp) {
|
|||||||
This is the only update for simple moves.
|
This is the only update for simple moves.
|
||||||
*/
|
*/
|
||||||
static void updpos( void) {
|
static void updpos( void) {
|
||||||
|
line_p lp ;
|
||||||
|
|
||||||
/* find the current row */
|
/* find the current row */
|
||||||
line_p lp = curwp->w_linep ;
|
|
||||||
currow = curwp->w_toprow ;
|
currow = curwp->w_toprow ;
|
||||||
while( lp != curwp->w_dotp) {
|
for( lp = curwp->w_linep ; lp != curwp->w_dotp ; lp = lforw( lp))
|
||||||
++currow ;
|
++currow ;
|
||||||
lp = lforw( lp) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find the current column */
|
/* find the current column */
|
||||||
curcol = 0 ;
|
curcol = 0 ;
|
||||||
@ -571,7 +580,6 @@ static void upddex( void) {
|
|||||||
|| (curcol < term.t_ncol - 1)) {
|
|| (curcol < term.t_ncol - 1)) {
|
||||||
vtmove( i, 0) ;
|
vtmove( i, 0) ;
|
||||||
show_line( lp) ;
|
show_line( lp) ;
|
||||||
vteeol() ;
|
|
||||||
|
|
||||||
/* this line no longer is extended */
|
/* this line no longer is extended */
|
||||||
vscreen[ i]->v_flag &= ~VFEXT ;
|
vscreen[ i]->v_flag &= ~VFEXT ;
|
||||||
@ -798,30 +806,20 @@ static int endofline( unicode_t *s, int n) {
|
|||||||
|
|
||||||
|
|
||||||
/* updext:
|
/* updext:
|
||||||
* update the extended line which the cursor is currently
|
update the extended line which the cursor is currently on at a column
|
||||||
* on at a column greater than the terminal width. The line
|
greater than the terminal width. The line will be scrolled right or
|
||||||
* will be scrolled right or left to let the user see where
|
left to let the user see where the cursor is.
|
||||||
* the cursor is
|
|
||||||
*/
|
*/
|
||||||
static void updext( void) {
|
static void updext( void) {
|
||||||
int rcursor ; /* real cursor location */
|
|
||||||
line_p lp ; /* pointer to current line */
|
|
||||||
|
|
||||||
/* calculate what column the real cursor will end up in */
|
/* calculate what column the real cursor will end up in */
|
||||||
rcursor = ((curcol - term.t_ncol) % term.t_scrsiz) + term.t_margin ;
|
lbound = curcol - ((curcol - term.t_ncol) % term.t_scrsiz + term.t_margin) ;
|
||||||
taboff = lbound = curcol - rcursor + 1 ;
|
|
||||||
|
|
||||||
/* scan through the line outputing characters to the virtual screen */
|
/* scan through the line outputing characters to the virtual screen */
|
||||||
/* once we reach the left edge */
|
/* once we reach the left edge */
|
||||||
vtmove( currow, -lbound) ; /* start scanning offscreen */
|
vtmove( currow, -lbound) ; /* start scanning offscreen */
|
||||||
lp = curwp->w_dotp ; /* line to output */
|
show_line( curwp->w_dotp) ;
|
||||||
show_line( lp) ;
|
|
||||||
|
|
||||||
/* truncate the virtual line, restore tab offset */
|
/* put a '$' in column 1 */
|
||||||
vteeol() ;
|
|
||||||
taboff = 0 ;
|
|
||||||
|
|
||||||
/* and put a '$' in column 1 */
|
|
||||||
vscreen[ currow]->v_text[ 0] = '$' ;
|
vscreen[ currow]->v_text[ 0] = '$' ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1329,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) ;
|
||||||
|
@ -25,6 +25,7 @@ void vtinit( void) ;
|
|||||||
void vtfree( void) ;
|
void vtfree( void) ;
|
||||||
void vttidy( void) ;
|
void vttidy( void) ;
|
||||||
void update( boolean force_f) ;
|
void update( boolean force_f) ;
|
||||||
|
void updmargin( void) ;
|
||||||
void upmode( void) ;
|
void upmode( void) ;
|
||||||
void movecursor( int row, int col) ;
|
void movecursor( int row, int col) ;
|
||||||
void mlerase( void) ;
|
void mlerase( void) ;
|
||||||
|
4
names.c
4
names.c
@ -50,8 +50,8 @@ 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", 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} ,
|
||||||
{" copy-region", copyregion, META | 'W'} ,
|
{" copy-region", copyregion, META | 'W'} ,
|
||||||
|
64
window.c
64
window.c
@ -566,11 +566,8 @@ 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)
|
||||||
@ -581,32 +578,33 @@ BINDABLE( newsize) {
|
|||||||
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)
|
||||||
|
/* no change */
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
else if( term.t_nrow < n - 1) {
|
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;
|
|
||||||
while (nextwp != NULL) {
|
|
||||||
wp = nextwp ;
|
wp = nextwp ;
|
||||||
nextwp = wp->w_wndp ;
|
nextwp = wp->w_wndp ;
|
||||||
|
|
||||||
/* get rid of it if it is too low */
|
if( wp->w_toprow == n - 2) {
|
||||||
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 */
|
||||||
|
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 ;
|
||||||
@ -616,29 +614,27 @@ BINDABLE( newsize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 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 ;
|
||||||
@ -652,9 +648,7 @@ BINDABLE( newsize) {
|
|||||||
* int f; default flag
|
* int f; default flag
|
||||||
* int n; numeric argument
|
* int n; numeric argument
|
||||||
*/
|
*/
|
||||||
BINDABLE( newwidth) {
|
BBINDABLE( newwidth) {
|
||||||
window_p wp;
|
|
||||||
|
|
||||||
/* if the command defaults, assume the largest */
|
/* if the command defaults, assume the largest */
|
||||||
if( f == FALSE)
|
if( f == FALSE)
|
||||||
n = term.t_mcol ;
|
n = term.t_mcol ;
|
||||||
@ -665,17 +659,13 @@ BINDABLE( newwidth) {
|
|||||||
|
|
||||||
/* otherwise, just re-width it (no big deal) */
|
/* otherwise, just re-width it (no big deal) */
|
||||||
term.t_ncol = n ;
|
term.t_ncol = n ;
|
||||||
term.t_margin = n / 10;
|
updmargin() ;
|
||||||
term.t_scrsiz = n - (term.t_margin * 2);
|
|
||||||
|
|
||||||
/* florce all windows to redraw */
|
/* force all windows to redraw */
|
||||||
wp = wheadp;
|
for( window_p wp = wheadp ; wp; wp = wp->w_wndp)
|
||||||
while (wp) {
|
|
||||||
wp->w_flag |= WFHARD | WFMOVE | WFMODE ;
|
wp->w_flag |= WFHARD | WFMOVE | WFMODE ;
|
||||||
wp = wp->w_wndp;
|
|
||||||
}
|
|
||||||
sgarbf = TRUE;
|
|
||||||
|
|
||||||
|
sgarbf = TRUE ;
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
window.h
4
window.h
@ -55,8 +55,8 @@ 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) ;
|
||||||
BINDABLE( newwidth) ;
|
BBINDABLE( newwidth) ;
|
||||||
BINDABLE( nextwind) ;
|
BINDABLE( nextwind) ;
|
||||||
BINDABLE( onlywind) ;
|
BINDABLE( onlywind) ;
|
||||||
BINDABLE( prevwind) ;
|
BINDABLE( prevwind) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user