mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-23 09:36:31 -05:00
Compare commits
No commits in common. "f96ace997f1ab5ca1a937e1a82c23a686891220f" and "0a8c28bc07d973c22864b8067f925dda21b6226e" have entirely different histories.
f96ace997f
...
0a8c28bc07
58
display.c
58
display.c
@ -63,6 +63,7 @@ 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 */
|
||||||
@ -135,14 +136,6 @@ 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) ;
|
||||||
@ -150,7 +143,6 @@ 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) ;
|
||||||
@ -226,7 +218,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 + lbound) % tabwidth) != 0)
|
while( ((vtcol + taboff) % tabwidth) != 0)
|
||||||
sane_vtputc( ' ') ;
|
sane_vtputc( ' ') ;
|
||||||
} else if( c < 0x20 || c == 0x7F) {
|
} else if( c < 0x20 || c == 0x7F) {
|
||||||
sane_vtputc( '^') ;
|
sane_vtputc( '^') ;
|
||||||
@ -468,8 +460,6 @@ 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() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -479,10 +469,9 @@ 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 ;
|
||||||
|
|
||||||
@ -495,6 +484,7 @@ 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() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -516,14 +506,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 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,12 +524,13 @@ 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 ;
|
||||||
for( lp = curwp->w_linep ; lp != curwp->w_dotp ; lp = lforw( lp))
|
while( lp != curwp->w_dotp) {
|
||||||
++currow ;
|
++currow ;
|
||||||
|
lp = lforw( lp) ;
|
||||||
|
}
|
||||||
|
|
||||||
/* find the current column */
|
/* find the current column */
|
||||||
curcol = 0 ;
|
curcol = 0 ;
|
||||||
@ -580,6 +571,7 @@ 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 ;
|
||||||
@ -806,20 +798,30 @@ static int endofline( unicode_t *s, int n) {
|
|||||||
|
|
||||||
|
|
||||||
/* updext:
|
/* updext:
|
||||||
update the extended line which the cursor is currently on at a column
|
* update the extended line which the cursor is currently
|
||||||
greater than the terminal width. The line will be scrolled right or
|
* on at a column greater than the terminal width. The line
|
||||||
left to let the user see where the cursor is.
|
* will be scrolled right or left to let the user see where
|
||||||
|
* 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 */
|
||||||
lbound = curcol - ((curcol - term.t_ncol) % term.t_scrsiz + term.t_margin) ;
|
rcursor = ((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 */
|
||||||
show_line( curwp->w_dotp) ;
|
lp = curwp->w_dotp ; /* line to output */
|
||||||
|
show_line( lp) ;
|
||||||
|
|
||||||
/* put a '$' in column 1 */
|
/* truncate the virtual line, restore tab offset */
|
||||||
|
vteeol() ;
|
||||||
|
taboff = 0 ;
|
||||||
|
|
||||||
|
/* and put a '$' in column 1 */
|
||||||
vscreen[ currow]->v_text[ 0] = '$' ;
|
vscreen[ currow]->v_text[ 0] = '$' ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1327,12 +1329,6 @@ 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,7 +25,6 @@ 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", (fnp_t) newsize, META | CTL_ | 'D'} , /* M^S */
|
{" change-screen-size", newsize, META | CTL_ | 'D'} , /* M^S */
|
||||||
{" change-screen-width", (fnp_t) newwidth, META | CTL_ | 'T'} ,
|
{" change-screen-width", 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,8 +566,11 @@ BINDABLE( restwnd) {
|
|||||||
* int f; default flag
|
* int f; default flag
|
||||||
* int n; numeric argument
|
* int n; numeric argument
|
||||||
*/
|
*/
|
||||||
BBINDABLE( newsize) {
|
BINDABLE( 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)
|
||||||
@ -578,33 +581,32 @@ BBINDABLE( 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 */
|
||||||
for( wp = wheadp ; wp->w_wndp != NULL ; wp = wp->w_wndp)
|
wp = wheadp;
|
||||||
;
|
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 */
|
||||||
window_p lastwp = NULL ;
|
nextwp = wheadp;
|
||||||
for( window_p nextwp = wheadp ; nextwp != NULL ; ) {
|
wp = NULL;
|
||||||
|
lastwp = NULL;
|
||||||
|
while (nextwp != NULL) {
|
||||||
wp = nextwp;
|
wp = nextwp;
|
||||||
nextwp = wp->w_wndp;
|
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;
|
||||||
@ -614,27 +616,29 @@ BBINDABLE( 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( wp) ;
|
free((char *) wp);
|
||||||
lastwp->w_wndp = NULL ;
|
wp = NULL;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* need to change this window size? */
|
/* need to change this window size? */
|
||||||
int lastline = wp->w_toprow + wp->w_ntrows - 1 ;
|
lastline = wp->w_toprow + wp->w_ntrows - 1;
|
||||||
if (lastline >= n - 2) {
|
if (lastline >= n - 2) {
|
||||||
wp->w_ntrows = n - wp->w_toprow - 2 ;
|
wp->w_ntrows =
|
||||||
assert( wp->w_ntrows) ;
|
n - wp->w_toprow - 2;
|
||||||
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;
|
||||||
@ -648,7 +652,9 @@ BBINDABLE( newsize) {
|
|||||||
* int f; default flag
|
* int f; default flag
|
||||||
* int n; numeric argument
|
* int n; numeric argument
|
||||||
*/
|
*/
|
||||||
BBINDABLE( newwidth) {
|
BINDABLE( 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;
|
||||||
@ -659,13 +665,17 @@ BBINDABLE( 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;
|
||||||
updmargin() ;
|
term.t_margin = n / 10;
|
||||||
|
term.t_scrsiz = n - (term.t_margin * 2);
|
||||||
|
|
||||||
/* force all windows to redraw */
|
/* florce all windows to redraw */
|
||||||
for( window_p wp = wheadp ; wp; wp = wp->w_wndp)
|
wp = wheadp;
|
||||||
|
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) ;
|
||||||
BBINDABLE( newsize) ;
|
BINDABLE( newsize) ;
|
||||||
BBINDABLE( newwidth) ;
|
BINDABLE( newwidth) ;
|
||||||
BINDABLE( nextwind) ;
|
BINDABLE( nextwind) ;
|
||||||
BINDABLE( onlywind) ;
|
BINDABLE( onlywind) ;
|
||||||
BINDABLE( prevwind) ;
|
BINDABLE( prevwind) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user