From fbdc659829a66b2bfb4439d18b1826434e546ef7 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 23 Oct 2016 23:15:11 -0600 Subject: * Deleting from the end of the line in the composer, still showed deleted characters. Reported bt Mark Peveto. --- pico/display.c | 87 +++++++++++++++++++++++++--------------------------------- pico/main.c | 6 ++-- 2 files changed, 42 insertions(+), 51 deletions(-) (limited to 'pico') diff --git a/pico/display.c b/pico/display.c index 7cd30909..6833ceef 100644 --- a/pico/display.c +++ b/pico/display.c @@ -143,7 +143,7 @@ vtinit(void) CELL ac; PCOLORS *pcolors = Pmaster && Pmaster->colors ? Pmaster->colors : Pcolors; - ac.c = '\0'; + ac.c = ' '; ac.a = 0; if(Pmaster == NULL) @@ -274,7 +274,7 @@ vtputc(CELL c) int w; vp = vscreen[vtrow]; - ac.c = '\0'; + ac.c = ' '; ac.a = c.a; ac.d = c.d; @@ -305,7 +305,6 @@ vtputc(CELL c) vp->v_text[vtind-1] = ac; } else if (c.c == '\t') { - ac.c = ' '; do { vtputc(ac); } @@ -363,7 +362,7 @@ vteeol(void) register VIDEO *vp; CELL c; - c.c = '\0'; + c.c = ' '; c.a = 0; vp = vscreen[vtrow]; @@ -620,16 +619,18 @@ out: lp = lforw(lp); } - for (j = 0, quoted = -1; j < llength(lp); ++j){ - if(quoted < 0){ - if(lgetc(lp,j).c != '>' && lgetc(lp, j).c != ' ') - quoted = 0; - else if(lgetc(lp,j).c == '>') - quoted = 1; - } - } + if(pcolors != NULL) + for (j = 0, quoted = -1; j < llength(lp); ++j){ + if(quoted < 0){ + if(lgetc(lp,j).c != '>' && lgetc(lp, j).c != ' ') + quoted = 0; + else if(lgetc(lp,j).c == '>') + quoted = 1; + } + } + else /* turn off quoted flag if there are no colors */ + quoted = 0; - vscreen[i]->v_flag &= ~(VFSIG|VFNOR|VFQUO); vscreen[i]->v_flag |= (quoted > 0 ? VFQUO : 0)|(lp->l_sig ? VFSIG : 0)| VFCHG; vtmove(i, 0); @@ -641,18 +642,20 @@ out: other: while (i < wp->w_toprow+wp->w_ntrows){ int flag = 0; - for (j = 0, quoted = -1; j < llength(lp) && quoted < 0; ++j){ - if(quoted < 0){ - if(lgetc(lp,j).c != '>' && lgetc(lp, j).c != ' ') - quoted = 0; - else if(lgetc(lp,j).c == '>') - quoted = 1; - } - } + if(pcolors != NULL) + for (j = 0, quoted = -1; j < llength(lp) && quoted < 0; ++j){ + if(quoted < 0){ + if(lgetc(lp,j).c != '>' && lgetc(lp, j).c != ' ') + quoted = 0; + else if(lgetc(lp,j).c == '>') + quoted = 1; + } + } + else /* turn off quoted flag if there are no colors */ + quoted = 0; if(repaint && (vscreen[i]->v_flag & VFSIG) && lp->l_sig == 0) flag |= VFNOR; if(quoted > 0) flag |= VFQUO; - vscreen[i]->v_flag &= ~(VFSIG | VFNOR | VFQUO); vscreen[i]->v_flag |= flag | (lp->l_sig ? VFSIG : 0 )| VFCHG; vtmove(i, 0); @@ -791,7 +794,7 @@ other: movecursor(wheadp->w_toprow, 0); } else{ - c.c = '\0'; + c.c = ' '; c.a = 0; for (i = 0; i < term.t_nrow-term.t_mrow; i++){ vscreen[i]->v_flag |= VFCHG; @@ -996,7 +999,6 @@ updateline(int row, /* row on screen */ int in_quote, quote_found = 0, level; PCOLORS *pcolors = Pmaster && Pmaster->colors ? Pmaster->colors : Pcolors; COLOR_PAIR *qcolor = NULL, *lastc = NULL; - int first = 1; int x; /* bit to indicate if we should eXecute a block below */ if(row < 0 || row > term.t_nrow) @@ -1008,8 +1010,8 @@ updateline(int row, /* row on screen */ cp3 = &vline[term.t_ncol]; /* advance past any common chars at the left */ - if(!(*flags & (VFSIG|VFNOR|VFQUO)) - && (pcolors == NULL || vline[0].c != ' ')) + if(pcolors == NULL + || !(*flags & (VFSIG|VFNOR|VFQUO)) && vline[0].c != ' ') while (cp1 != cp3 && cp1[0].c == cp2[0].c && cp1[0].a == cp2[0].a) { ++cp1; ++cp2; @@ -1033,17 +1035,17 @@ updateline(int row, /* row on screen */ cp4 = &pline[term.t_ncol]; if(cellwidth_ptr_to_ptr(cp1, cp3) == cellwidth_ptr_to_ptr(cp2, cp4)) - while (cp3 != cp1 && cp3[-1].c == cp4[-1].c && cp3[-1].a == cp4[-1].a) { + while (cp3[-1].c == cp4[-1].c && cp3[-1].a == cp4[-1].a) { --cp3; --cp4; - if (cp3[0].c != '\0' || cp3[0].a != 0) /* Note if any nonblank */ + if (cp3[0].c != ' ' || cp3[0].a != 0) /* Note if any nonblank */ nbflag = TRUE; /* in right match. */ } cp5 = cp3; if (nbflag == FALSE && TERM_EOLEXIST) { /* Erase to EOL ? */ - while (cp5 != cp1 && cp5[-1].c == '\0' && cp5[-1].a == 0) + while (cp5 != cp1 && cp5[-1].c == ' ' && cp5[-1].a == 0) --cp5; if (cp3-cp5 <= 3) /* Use only if erase is */ @@ -1053,13 +1055,7 @@ updateline(int row, /* row on screen */ /* go to start of differences */ movecursor(row, cellwidth_ptr_to_ptr(&vline[0], cp1)); - /* the next code inserts a character or deletes one in the middle - * of a line. However, we do not need this code to work when we - * are using colors that depend on what is inserted/deleted, so - * we defer this work to the code below - */ - x = pcolors && (pcolors->qlcp || pcolors->qllcp || pcolors->qlllcp); - if (!nbflag && x == 0) { /* use insert or del char? */ + if (!nbflag){ /* use insert or del char? */ cp6 = cp3; cp7 = cp4; @@ -1099,8 +1095,8 @@ updateline(int row, /* row on screen */ } } - if(cp1 == cp5 && (*flags & (VFSIG|VFNOR|VFQUO))) - while(cp5 < &vline[term.t_ncol] && cp5->c != '\0') + if(pcolors && cp1 == cp5 && (*flags & (VFSIG|VFNOR|VFQUO))) + while(cp5 < &vline[term.t_ncol] && cp5->c != ' ') cp5++; if(cp1 != cp5 && display){ @@ -1193,16 +1189,8 @@ updateline(int row, /* row on screen */ } } - /* cp1->c could be null because we set it up that way by default. Initialization - * is made with null characters. We did this because otherwise Pico does not - * color trailing spaces in lines, so this gives a way for pico to distinguish - * trailing spaces in lines from its own old default initialization of cells - * using spaces. So when we get a null character we output the corresponding - * space that would have been output in the past. If you want to see what - * would happen if we output a null character, rewrite the code below. - */ (*term.t_rev)(cp1->a); /* set inverse for this char */ - (*term.t_putchar)(cp1->c || pcolors == NULL ? cp1->c : ' '); + (*term.t_putchar)((UCS) cp1->c); } ww = wcellwidth((UCS) cp1->c); @@ -1226,7 +1214,8 @@ updateline(int row, /* row on screen */ *cp2++ = *cp1++; } - *flags &= ~VFCHG; /* flag this line is changed */ + *flags &= ~(VFCHG|VFSIG|VFNOR|VFQUO); /* flag this line is changed +*/ } @@ -3046,7 +3035,7 @@ peeol(void) if(ttrow < 0 || ttrow > term.t_nrow) return; - cl.c = '\0'; + cl.c = ' '; cl.a = 0; /* diff --git a/pico/main.c b/pico/main.c index 1123b467..eba0b3bd 100644 --- a/pico/main.c +++ b/pico/main.c @@ -409,13 +409,12 @@ main(int argc, char *argv[]) peeol(); } + update(); /* Fix up the screen */ if(km_popped){ term.t_mrow = 0; curwp->w_ntrows += 2; } - update(); /* Fix up the screen */ - #ifdef MOUSE #ifdef EX_MOUSE /* New mouse function for real mouse text seletion. */ @@ -976,6 +975,9 @@ Loop: tbfc, tbbc, klfc, klbc, knfc, knbc, stfc, stbc, prfc, prbc, q1fc, q1bc, q2fc, q2bc, q3fc, q3bc, sbfc, sbbc); + if(Pcolors) + pico_toggle_color(1); + /* return the first filename for editing */ if(ac > 0) return(*av); -- cgit v1.2.3-54-g00ecf