mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
vim-patch:8.2.3122: with 'nowrap' cursor position is unexected in narrow window (#17935)
Problem: With 'nowrap' cursor position is unexected in narrow window.
(Leonid V. Fedorenchik)
Solution: Put cursor on the last non-empty line. (closes vim/vim#8525)
30441bb3d5
This commit is contained in:
@@ -778,8 +778,13 @@ void curs_columns(win_T *wp, int may_scroll)
|
||||
int textwidth = wp->w_width_inner - extra;
|
||||
if (textwidth <= 0) {
|
||||
// No room for text, put cursor in last char of window.
|
||||
// If not wrapping, the last non-empty line.
|
||||
wp->w_wcol = wp->w_width_inner - 1;
|
||||
wp->w_wrow = wp->w_height_inner - 1;
|
||||
if (wp->w_p_wrap) {
|
||||
wp->w_wrow = wp->w_height_inner - 1;
|
||||
} else {
|
||||
wp->w_wrow = wp->w_height_inner - 1 - wp->w_empty_rows;
|
||||
}
|
||||
} else if (wp->w_p_wrap
|
||||
&& wp->w_width_inner != 0) {
|
||||
width = textwidth + win_col_off2(wp);
|
||||
|
@@ -542,6 +542,12 @@ func Test_listchars_foldcolumn()
|
||||
call VerifyScreenDump(buf, 'Test_listchars_04', {})
|
||||
call term_sendkeys(buf, "\<C-W>>")
|
||||
call VerifyScreenDump(buf, 'Test_listchars_05', {})
|
||||
call term_sendkeys(buf, "\<C-W>h")
|
||||
call term_sendkeys(buf, ":set nowrap foldcolumn=4\<CR>")
|
||||
call term_sendkeys(buf, "15\<C-W><")
|
||||
call VerifyScreenDump(buf, 'Test_listchars_06', {})
|
||||
call term_sendkeys(buf, "4\<C-W><")
|
||||
call VerifyScreenDump(buf, 'Test_listchars_07', {})
|
||||
|
||||
" clean up
|
||||
call StopVimInTerminal(buf)
|
||||
|
Reference in New Issue
Block a user