From ee8681d7cc8bf79eebf74c03f355fdeb470c0862 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Wed, 19 Jul 2017 22:14:21 -0500 Subject: [PATCH] tweaks: only compensate for a partially-offscreen line in softwrap mode A line can only be partially offscreen when doing softwrapping. --- src/winio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/winio.c b/src/winio.c index 68405326..eaf528cd 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2949,12 +2949,14 @@ void edit_scroll(scroll_dir direction, int nrows) go_forward_chunks(editwinrows - nrows, &line, &leftedge); #ifndef NANO_TINY - /* Compensate for the earlier chunks of a softwrapped line. */ - nrows += chunk_for(leftedge, line); + if (ISSET(SOFTWRAP)) { + /* Compensate for the earlier chunks of a softwrapped line. */ + nrows += chunk_for(leftedge, line); - /* Don't compensate for the chunks that are offscreen. */ - if (line == openfile->edittop) - nrows -= chunk_for(openfile->firstcolumn, line); + /* Don't compensate for the chunks that are offscreen. */ + if (line == openfile->edittop) + nrows -= chunk_for(openfile->firstcolumn, line); + } #endif /* Draw new content on the blank rows inside the scrolled region