commit ee8681d7cc8bf79eebf74c03f355fdeb470c0862
parent a1fba434520be4320cfe76d0a62fb3bd42658e2d
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 19 Jul 2017 22:14:21 -0500
tweaks: only compensate for a partially-offscreen line in softwrap mode
A line can only be partially offscreen when doing softwrapping.
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git 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