mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 23:36:23 -05:00
Show lines with a single helper function, not one byte at a time
Let's see how hard it is to show UTF-8 characters properly. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1d0cfd0276
commit
2dddd4f970
24
display.c
24
display.c
@ -432,6 +432,13 @@ static int reframe(struct window *wp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void show_line(struct line *lp)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < llength(lp); ++i)
|
||||||
|
vtputc(lgetc(lp, i));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* updone:
|
* updone:
|
||||||
* update the current line to the virtual screen
|
* update the current line to the virtual screen
|
||||||
@ -442,7 +449,6 @@ static void updone(struct window *wp)
|
|||||||
{
|
{
|
||||||
struct line *lp; /* line to update */
|
struct line *lp; /* line to update */
|
||||||
int sline; /* physical screen line to update */
|
int sline; /* physical screen line to update */
|
||||||
int i;
|
|
||||||
|
|
||||||
/* search down the line we want */
|
/* search down the line we want */
|
||||||
lp = wp->w_linep;
|
lp = wp->w_linep;
|
||||||
@ -456,8 +462,7 @@ static void updone(struct window *wp)
|
|||||||
vscreen[sline]->v_flag |= VFCHG;
|
vscreen[sline]->v_flag |= VFCHG;
|
||||||
vscreen[sline]->v_flag &= ~VFREQ;
|
vscreen[sline]->v_flag &= ~VFREQ;
|
||||||
vtmove(sline, 0);
|
vtmove(sline, 0);
|
||||||
for (i = 0; i < llength(lp); ++i)
|
show_line(lp);
|
||||||
vtputc(lgetc(lp, i));
|
|
||||||
#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;
|
||||||
@ -475,7 +480,6 @@ static void updall(struct window *wp)
|
|||||||
{
|
{
|
||||||
struct line *lp; /* line to update */
|
struct line *lp; /* line to update */
|
||||||
int sline; /* physical screen line to update */
|
int sline; /* physical screen line to update */
|
||||||
int i;
|
|
||||||
|
|
||||||
/* search down the lines, updating them */
|
/* search down the lines, updating them */
|
||||||
lp = wp->w_linep;
|
lp = wp->w_linep;
|
||||||
@ -488,8 +492,7 @@ static void updall(struct window *wp)
|
|||||||
vtmove(sline, 0);
|
vtmove(sline, 0);
|
||||||
if (lp != wp->w_bufp->b_linep) {
|
if (lp != wp->w_bufp->b_linep) {
|
||||||
/* if we are not at the end */
|
/* if we are not at the end */
|
||||||
for (i = 0; i < llength(lp); ++i)
|
show_line(lp);
|
||||||
vtputc(lgetc(lp, i));
|
|
||||||
lp = lforw(lp);
|
lp = lforw(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +557,7 @@ void upddex(void)
|
|||||||
{
|
{
|
||||||
struct window *wp;
|
struct window *wp;
|
||||||
struct line *lp;
|
struct line *lp;
|
||||||
int i, j;
|
int i;
|
||||||
|
|
||||||
wp = wheadp;
|
wp = wheadp;
|
||||||
|
|
||||||
@ -567,8 +570,7 @@ void upddex(void)
|
|||||||
if ((wp != curwp) || (lp != wp->w_dotp) ||
|
if ((wp != curwp) || (lp != wp->w_dotp) ||
|
||||||
(curcol < term.t_ncol - 1)) {
|
(curcol < term.t_ncol - 1)) {
|
||||||
vtmove(i, 0);
|
vtmove(i, 0);
|
||||||
for (j = 0; j < llength(lp); ++j)
|
show_line(lp);
|
||||||
vtputc(lgetc(lp, j));
|
|
||||||
vteeol();
|
vteeol();
|
||||||
|
|
||||||
/* this line no longer is extended */
|
/* this line no longer is extended */
|
||||||
@ -833,7 +835,6 @@ static void updext(void)
|
|||||||
{
|
{
|
||||||
int rcursor; /* real cursor location */
|
int rcursor; /* real cursor location */
|
||||||
struct line *lp; /* pointer to current line */
|
struct line *lp; /* pointer to current line */
|
||||||
int j; /* index into 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;
|
rcursor = ((curcol - term.t_ncol) % term.t_scrsiz) + term.t_margin;
|
||||||
@ -843,8 +844,7 @@ static void updext(void)
|
|||||||
/* 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 */
|
lp = curwp->w_dotp; /* line to output */
|
||||||
for (j = 0; j < llength(lp); ++j) /* until the end-of-line */
|
show_line(lp);
|
||||||
vtputc(lgetc(lp, j));
|
|
||||||
|
|
||||||
/* truncate the virtual line, restore tab offset */
|
/* truncate the virtual line, restore tab offset */
|
||||||
vteeol();
|
vteeol();
|
||||||
|
Loading…
Reference in New Issue
Block a user