nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 2f80193d96df920e515dc77cb01a097c48221853
parent 23595c837615f66c937176b40b32dc6ab54f4b25
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Fri, 20 Jan 2017 21:27:49 +0100

tweaks: reshuffle a test to a better place

Diffstat:
Msrc/winio.c | 18+++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -2509,31 +2509,27 @@ void edit_draw(filestruct *fileptr, const char *converted, /* If there is no end, there is nothing to paint. */ if (end_line == NULL) goto tail_of_loop; - /* If the end is scrolled off to the left, next step. */ - if (end_line == fileptr && endmatch.rm_eo <= from_x) { - fileptr->multidata[varnish->id] = CBEGINBEFORE; - goto step_two; - } - /* Now paint the start of the line. However, if the end match - * is on a different line, paint the whole line, and go on. */ + /* If the end is on a later line, paint whole line, and be done. */ if (end_line != fileptr) { mvwaddnstr(edit, row, margin, converted, -1); fileptr->multidata[varnish->id] = CWHOLELINE; #ifdef DEBUG fprintf(stderr, " Marking for id %i row %i as CWHOLELINE\n", varnish->id, row); #endif - /* Don't bother looking for any more starts. */ goto tail_of_loop; - } else { + } + + /* Only if it is visible, paint the part to be coloured. */ + if (endmatch.rm_eo > from_x) { paintlen = actual_x(converted, strnlenpt(fileptr->data, endmatch.rm_eo) - from_col); mvwaddnstr(edit, row, margin, converted, paintlen); - fileptr->multidata[varnish->id] = CBEGINBEFORE; + } + fileptr->multidata[varnish->id] = CBEGINBEFORE; #ifdef DEBUG fprintf(stderr, " Marking for id %i row %i as CBEGINBEFORE\n", varnish->id, row); #endif - } step_two: /* Second step: look for starts on this line, but begin * looking only after an end match, if there is one. */