summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-08 13:19:31 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-08 13:19:31 +0200
commit30441bb3d5fa73f888b09684db3f54ff5ab48dbc (patch)
treea1061744b892daf8b62f10917039631ca457fda8
parent41fb723ee97baa2f095cde601a5a144b168b7a6b (diff)
patch 8.2.3122: with 'nowrap' cursor position is unexected in narrow windowv8.2.3122
Problem: With 'nowrap' cursor position is unexected in narrow window. (Leonid V. Fedorenchik) Solution: Put cursor on the last non-empty line. (closes #8525)
-rw-r--r--src/move.c6
-rw-r--r--src/testdir/dumps/Test_listchars_06.dump10
-rw-r--r--src/testdir/dumps/Test_listchars_07.dump10
-rw-r--r--src/testdir/test_listchars.vim6
-rw-r--r--src/version.c2
5 files changed, 33 insertions, 1 deletions
diff --git a/src/move.c b/src/move.c
index d90e4d2d96..ed220f76ce 100644
--- 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)
{
diff --git a/src/testdir/dumps/Test_listchars_06.dump b/src/testdir/dumps/Test_listchars_06.dump
new file mode 100644
index 0000000000..9f4b5d30e2
--- /dev/null
+++ b/src/testdir/dumps/Test_listchars_06.dump
@@ -0,0 +1,10 @@
+| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @13||+1&&| +0#0000e05#a8a8a8255@4||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @26
+| +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@16||+1&&| +0#0000e05#a8a8a8255@4||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@29
+| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @15||+1&&| +0#0000e05#a8a8a8255@4||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @28
+| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @10||+1&&| +0#0000e05#a8a8a8255@3> ||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @23
+|~+0#4040ff13&| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31
+|~| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31
+|~| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31
+|~| @18||+1#0000000&|~+0#4040ff13&| @3||+1#0000000&|~+0#4040ff13&| @31
+|<+1#0000000&|a|m|e|]| |[|+|]| |1|,|1| @3|A|l@1| |<+3&&|]| |1|,| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @3|1|,|1| @9|A|l@1
+|:+0&&|s|e|t| |n|o|w|r|a|p| |f|o|l|d|c|o|l|u|m|n|=|4| @35
diff --git a/src/testdir/dumps/Test_listchars_07.dump b/src/testdir/dumps/Test_listchars_07.dump
new file mode 100644
index 0000000000..ad81656a50
--- /dev/null
+++ b/src/testdir/dumps/Test_listchars_07.dump
@@ -0,0 +1,10 @@
+| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @13||+1&&| +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@2| @30
+| +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@16||+1&&| +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2| +0#0000000#ffffff0@33
+| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @15||+1&&| +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0| @32
+| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @10||+1&&> +0#0000e05#a8a8a8255||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@2|a+0#0000000#ffffff0@5| @27
+|~+0#4040ff13&| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35
+|~| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35
+|~| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35
+|~| @18||+1#0000000&|~+0#4040ff13&||+1#0000000&|~+0#4040ff13&| @35
+|<+1#0000000&|a|m|e|]| |[|+|]| |1|,|1| @3|A|l@1| |<+3&&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1
+|:+0&&|s|e|t| |n|o|w|r|a|p| |f|o|l|d|c|o|l|u|m|n|=|4| @35
diff --git a/src/testdir/test_listchars.vim b/src/testdir/test_listchars.vim
index 7068be7402..160d247c0e 100644
--- a/src/testdir/test_listchars.vim
+++ b/src/testdir/test_listchars.vim
@@ -381,6 +381,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)
diff --git a/src/version.c b/src/version.c
index fc65ac0c3d..518844f351 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3122,
+/**/
3121,
/**/
3120,