]> granicus.if.org Git - vim/commitdiff
patch 8.1.1757: text added with appendbufline() isn't displayed v8.1.1757
authorBram Moolenaar <Bram@vim.org>
Sat, 27 Jul 2019 15:39:15 +0000 (17:39 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 27 Jul 2019 15:39:15 +0000 (17:39 +0200)
Problem:    Text added with appendbufline() to another buffer isn't displayed.
Solution:   Update topline. (partly by Christian Brabandt, closes #4718)

src/evalfunc.c
src/testdir/dumps/Test_appendbufline_1.dump [new file with mode: 0644]
src/testdir/test_bufline.vim
src/version.c

index 685e2f1e41c7285d9e564ba94f7542492fd661e6..c0b6788c292f2da5b01776e44dfdc2381ff8ae85 100644 (file)
@@ -1401,12 +1401,7 @@ set_buffer_lines(
            if (wp->w_buffer == buf && wp->w_cursor.lnum > append_lnum)
                wp->w_cursor.lnum += added;
        check_cursor_col();
-
-#ifdef FEAT_JOB_CHANNEL
-       if (bt_prompt(curbuf) && (State & INSERT))
-           // show the line with the prompt
-           update_topline();
-#endif
+       update_topline();
     }
 
     if (!is_curbuf)
diff --git a/src/testdir/dumps/Test_appendbufline_1.dump b/src/testdir/dumps/Test_appendbufline_1.dump
new file mode 100644 (file)
index 0000000..470256d
--- /dev/null
@@ -0,0 +1,10 @@
+| +0&#ffffff0@74
+|H|e|l@1|o| |V|i|m| |w|o|r|l|d|.@2| @56
+|~+0#4040ff13&| @73
+|~| @73
+|f+1#0000000&|o@1| |[|+|]| @49|1|,|0|-|1| @9|A|l@1
+> +0&&@74
+|~+0#4040ff13&| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+|-+0&&@1|N|o| |l|i|n|e|s| |i|n| |b|u|f@1|e|r|-@1| @52
index dbcd2e0fd63e7b13dc9f8df29d4d511a25282514..eb46104a8931878a63dd24655bc3b1f1b3305791 100644 (file)
@@ -1,6 +1,7 @@
 " Tests for setbufline(), getbufline(), appendbufline(), deletebufline()
 
 source shared.vim
+source screendump.vim
 
 func Test_setbufline_getbufline()
   new
@@ -144,3 +145,28 @@ func Test_deletebufline()
   call assert_equal(['b', 'c'], getbufline(b, 1, 2))
   exe "bwipe! " . b
 endfunc
+
+func Test_appendbufline_redraw()
+  if !CanRunVimInTerminal()
+    throw 'Skipped: cannot make screendumps'
+  endif
+  let lines =<< trim END
+    new foo
+    let winnr=bufwinnr('foo')
+    let buf=bufnr('foo')
+    wincmd p
+    call appendbufline(buf, '$', range(1,200))
+    exe winnr. 'wincmd w'
+    norm! G
+    wincmd p
+    call deletebufline(buf, 1, '$')
+    call appendbufline(buf, '$', 'Hello Vim world...')
+  END
+  call writefile(lines, 'XscriptMatchCommon')
+  let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 10})
+  call term_wait(buf)
+  call VerifyScreenDump(buf, 'Test_appendbufline_1', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XscriptMatchCommon')
+endfunc
index b036b3aaef4fd97801a76efd895b0efa67a4b29a..5444c772ac29de47126f2d89071f8a88f01066de 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1757,
 /**/
     1756,
 /**/