nano

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

commit a898fa5dcc7ecf7cca9d8c320dcd34c08c18338a
parent c0aa5ad258861f907d29894e5aa44f7e2ad92c19
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon,  9 Jan 2017 19:14:51 +0100

tweaks: if there is no end match, there is nothing to paint

When there is no end match after a start, it is pointless to look
for any more starts because also they will not have any end match,
so nothing will get painted -- just cut the loop short.

Diffstat:
Msrc/winio.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -2504,9 +2504,10 @@ void edit_draw(filestruct *fileptr, const char *converted, 1, &endmatch, 0) == REG_NOMATCH) end_line = end_line->next; - /* If no end was found, or it is too early, next step. */ + /* If there is no end, there is nothing to paint. */ if (end_line == NULL) - goto step_two; + 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;