Mercurial > vim
diff src/move.c @ 25172:406ab8d0bc0f v8.2.3122
patch 8.2.3122: with 'nowrap' cursor position is unexected in narrow window
Commit: https://github.com/vim/vim/commit/30441bb3d5fa73f888b09684db3f54ff5ab48dbc
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 8 13:19:31 2021 +0200
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 08 Jul 2021 13:30:04 +0200 |
parents | 68f506771741 |
children | 7a254d0705e2 |
line wrap: on
line diff
--- a/src/move.c +++ b/src/move.c @@ -993,8 +993,12 @@ curs_columns( 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) {