softwrap: don't scroll half a page when just a few lines will do

This fixes https://savannah.gnu.org/bugs/?49824.
master
Benno Schulenberg 2017-01-03 15:26:05 +01:00
parent 13176792f0
commit 8d692a87dc
1 changed files with 6 additions and 1 deletions

View File

@ -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. */