patch 8.2.3122: with 'nowrap' cursor position is unexected in narrow window
Problem: With 'nowrap' cursor position is unexected in narrow window.
(Leonid V. Fedorenchik)
Solution: Put cursor on the last non-empty line. (closes #8525)
diff --git a/src/move.c b/src/move.c
index d90e4d2..ed220f7 100644
--- a/src/move.c
+++ b/src/move.c
@@ -993,8 +993,12 @@
if (textwidth <= 0)
{
// No room for text, put cursor in last char of window.
+ // If not wrapping, the last non-empty line.
curwin->w_wcol = curwin->w_width - 1;
- curwin->w_wrow = curwin->w_height - 1;
+ if (curwin->w_p_wrap)
+ curwin->w_wrow = curwin->w_height - 1;
+ else
+ curwin->w_wrow = curwin->w_height - 1 - curwin->w_empty_rows;
}
else if (curwin->w_p_wrap && curwin->w_width != 0)
{