From ec4ee1c48916ee5bd525e5b3fcfb2d214d3a5abc Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 9 Jan 2016 20:21:29 +0000 Subject: [PATCH] Not going beyond the number of available rows in the edit window. This fixes Savannah bug #42188. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5539 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/winio.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 17d9bbfa..c17e970b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * src/color.c (precalc_multicolorinfo), src/winio.c (edit_draw): Make sure to keep advancing also when matches are zero-length. This fixes Savannah bug #26977 reported by Tigrmesh. + * src/winio.c (update_line): For softwrap, don't go beyond the number + of available rows in the edit window. This fixes Savannah bug #42188. 2016-01-07 Benno Schulenberg * src/global.c (assign_keyinfo): Delete two unneeded #ifdefs: if diff --git a/src/winio.c b/src/winio.c index 06d8889f..78dd30e4 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2789,7 +2789,7 @@ int update_line(filestruct *fileptr, size_t index) #ifndef NANO_TINY } else { size_t full_length = strlenpt(fileptr->data); - for (index += COLS; index <= full_length && line < editwinrows; index += COLS) { + for (index += COLS; index <= full_length && line < editwinrows - 1; index += COLS) { line++; #ifdef DEBUG fprintf(stderr, "update_line(): softwrap code, moving to %d index %lu\n", line, (unsigned long)index); -- 2.39.5