nano

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

commit c8c6340ce8764d7315519ef37f3f8cb3044ddbea
parent 626341635537899f73b369d444bfea1b9d7c1cb7
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Thu,  8 Dec 2016 09:56:16 -0600

tweaks: conditionalize a bit of softwrap code

This addresses https://savannah.gnu.org/bugs/?49803.

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

diff --git a/src/winio.c b/src/winio.c @@ -2804,31 +2804,31 @@ bool need_horizontal_scroll(const size_t old_column, const size_t new_column) return (get_page_start(old_column) != get_page_start(new_column)); } -/* When edittop changes, try and figure out how many lines - * we really have to work with (i.e. set maxrows). */ +/* When edittop changes, try and figure out how many lines we really + * have to work with, accounting for softwrap mode. */ void compute_maxrows(void) { - int n; - filestruct *foo = openfile->edittop; - - if (!ISSET(SOFTWRAP)) { - maxrows = editwinrows; - return; - } +#ifndef NANO_TINY + if (ISSET(SOFTWRAP)) { + int n; + filestruct *foo = openfile->edittop; - maxrows = 0; - for (n = 0; n < editwinrows && foo; n++) { - maxrows++; - n += strlenpt(foo->data) / editwincols; - foo = foo->next; - } + maxrows = 0; + for (n = 0; n < editwinrows && foo; n++) { + maxrows++; + n += strlenpt(foo->data) / editwincols; + foo = foo->next; + } - if (n < editwinrows) - maxrows += editwinrows - n; + if (n < editwinrows) + maxrows += editwinrows - n; #ifdef DEBUG - fprintf(stderr, "compute_maxrows(): maxrows = %d\n", maxrows); + fprintf(stderr, "compute_maxrows(): maxrows = %d\n", maxrows); #endif + } else +#endif /* !NANO_TINY */ + maxrows = editwinrows; } /* Scroll the edit window in the given direction and the given number