summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-10-02 21:20:32 +0200
committerBram Moolenaar <Bram@vim.org>2018-10-02 21:20:32 +0200
commit7701f308565fdc7b5096a6597d9c3b63de0bbcec (patch)
treeecc3673dfe38d99a4664f1a1821cc90513bae8e4
parent4a5abbd6138240d109278fe1f0b45489d22f712d (diff)
patch 8.1.0449: when 'rnu' is set folded lines are not displayed correctlyv8.1.0449
Problem: When 'rnu' is set folded lines are not displayed correctly. (Vitaly Yashin) Solution: When only redrawing line numbers do draw folded lines. (closes #3484)
-rw-r--r--src/screen.c17
-rw-r--r--src/testdir/dumps/Test_folds_with_rnu_01.dump20
-rw-r--r--src/testdir/dumps/Test_folds_with_rnu_02.dump20
-rw-r--r--src/testdir/test_fold.vim21
-rw-r--r--src/version.c2
5 files changed, 75 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index 4effa5286b..01428c4da6 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2176,7 +2176,14 @@ win_update(win_T *wp)
{
// 'relativenumber' set: The text doesn't need to be drawn, but
// the number column nearly always does.
- (void)win_line(wp, lnum, srow, wp->w_height, TRUE, TRUE);
+ fold_count = foldedCount(wp, lnum, &win_foldinfo);
+ if (fold_count != 0)
+ {
+ fold_line(wp, fold_count, &win_foldinfo, lnum, row);
+ --fold_count;
+ }
+ else
+ (void)win_line(wp, lnum, srow, wp->w_height, TRUE, TRUE);
}
// This line does not need to be drawn, advance to the next one.
@@ -3315,8 +3322,8 @@ win_line(
has_spell = TRUE;
extra_check = TRUE;
- /* Get the start of the next line, so that words that wrap to the next
- * line are found too: "et<line-break>al.".
+ /* Get the start of the next line, so that words that wrap to the
+ * next line are found too: "et<line-break>al.".
* Trick: skip a few chars for C/shell/Vim comments */
nextline[SPWORDLEN] = NUL;
if (lnum < wp->w_buffer->b_ml.ml_line_count)
@@ -3325,8 +3332,8 @@ win_line(
spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN);
}
- /* When a word wrapped from the previous line the start of the current
- * line is valid. */
+ /* When a word wrapped from the previous line the start of the
+ * current line is valid. */
if (lnum == checked_lnum)
cur_checked_col = checked_col;
checked_lnum = 0;
diff --git a/src/testdir/dumps/Test_folds_with_rnu_01.dump b/src/testdir/dumps/Test_folds_with_rnu_01.dump
new file mode 100644
index 0000000000..15a44d1999
--- /dev/null
+++ b/src/testdir/dumps/Test_folds_with_rnu_01.dump
@@ -0,0 +1,20 @@
+|++0#0000e05#a8a8a8255| @2|0| >+|-@1| @1|2| |l|i|n|e|s|:| |-@54
+|+| @2|1| |+|-@1| @1|2| |l|i|n|e|s|:| |-@54
+| @1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_folds_with_rnu_02.dump b/src/testdir/dumps/Test_folds_with_rnu_02.dump
new file mode 100644
index 0000000000..60d4eb3b37
--- /dev/null
+++ b/src/testdir/dumps/Test_folds_with_rnu_02.dump
@@ -0,0 +1,20 @@
+|++0#0000e05#a8a8a8255| @2|1| |+|-@1| @1|2| |l|i|n|e|s|:| |-@54
+|+| @2|0| >+|-@1| @1|2| |l|i|n|e|s|:| |-@54
+| @1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @71
+| +0#0000000&@56|3|,|1| @10|A|l@1|
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index df4b12c8ce..0384b4fd00 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -1,6 +1,7 @@
" Test for folding
source view_util.vim
+source screendump.vim
func PrepIndent(arg)
return [a:arg] + repeat(["\t".a:arg], 5)
@@ -674,3 +675,23 @@ func Test_fold_last_line_with_pagedown()
set fdm&
enew!
endfunc
+
+func Test_folds_with_rnu()
+ if !CanRunVimInTerminal()
+ return
+ endif
+
+ call writefile([
+ \ 'set fdm=marker rnu foldcolumn=2',
+ \ 'call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])',
+ \ ], 'Xtest_folds_with_rnu')
+ let buf = RunVimInTerminal('-S Xtest_folds_with_rnu', {})
+
+ call VerifyScreenDump(buf, 'Test_folds_with_rnu_01', {})
+ call term_sendkeys(buf, "j")
+ call VerifyScreenDump(buf, 'Test_folds_with_rnu_02', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_folds_with_rnu')
+endfunc
diff --git a/src/version.c b/src/version.c
index 928a07ee8a..a0aa0dc716 100644
--- a/src/version.c
+++ b/src/version.c
@@ -793,6 +793,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 449,
+/**/
448,
/**/
447,