From 8d692a87dc61d8340ec65b7ab27eaa472f6caf55 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 3 Jan 2017 15:26:05 +0100 Subject: [PATCH] softwrap: don't scroll half a page when just a few lines will do This fixes https://savannah.gnu.org/bugs/?49824. --- src/nano.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nano.c b/src/nano.c index c8fa42d1..0e371d50 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1767,6 +1767,10 @@ int do_mouse(void) ((mouse_y - current_row) * editwincols) + mouse_x); } else openfile->current_x = actual_x(openfile->current->data, mouse_x); + + openfile->current_y = current_row; + ensure_line_is_visible(); + refresh_needed = TRUE; } else #endif /* NANO_TINY */ { @@ -1796,7 +1800,8 @@ int do_mouse(void) /* The cursor moved; clean the cutbuffer on the next cut. */ cutbuffer_reset(); - edit_redraw(current_save); + if (!ISSET(SOFTWRAP)) + edit_redraw(current_save); } /* No more handling is needed. */