To: vim_dev@googlegroups.com Subject: Patch 8.1.0522 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0522 Problem: :terminal does not show trailing empty lines. Solution: Add empty lines. (Hirohito Higashi, closes #3605) Files: src/terminal.c, src/testdir/test_terminal.vim *** ../vim-8.1.0521/src/terminal.c 2018-10-23 21:42:55.449760330 +0200 --- src/terminal.c 2018-11-11 21:52:13.823591882 +0100 *************** *** 1592,1597 **** --- 1592,1606 ---- } } + // Add trailing empty lines. + for (pos.row = term->tl_scrollback.ga_len; + pos.row < term->tl_scrollback_scrolled + term->tl_cursor_pos.row; + ++pos.row) + { + if (add_empty_scrollback(term, &fill_attr, 0) == OK) + add_scrollback_line_to_buffer(term, (char_u *)"", 0); + } + term->tl_dirty_snapshot = FALSE; #ifdef FEAT_TIMERS term->tl_timer_set = FALSE; *** ../vim-8.1.0521/src/testdir/test_terminal.vim 2018-11-03 21:47:10.949346136 +0100 --- src/testdir/test_terminal.vim 2018-11-11 21:47:20.154059795 +0100 *************** *** 1658,1660 **** --- 1658,1682 ---- call WaitForAssert({-> assert_false(bufexists(bnr))}) call assert_equal(1, winnr('$')) endfunc + + func Test_terminal_does_not_truncate_last_newlines() + let cmd = has('win32') ? 'type' : 'cat' + let contents = [ + \ [ 'One', '', 'X' ], + \ [ 'Two', '', '' ], + \ [ 'Three' ] + repeat([''], 30) + \ ] + + for c in contents + call writefile(c, 'Xfile') + exec 'term' cmd 'Xfile' + let bnr = bufnr('$') + call assert_equal('terminal', getbufvar(bnr, '&buftype')) + call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))}) + sleep 50m + call assert_equal(c, getline(1, line('$'))) + quit + endfor + + call delete('Xfile') + endfunc *** ../vim-8.1.0521/src/version.c 2018-11-11 21:22:53.649977524 +0100 --- src/version.c 2018-11-11 22:17:05.407532879 +0100 *************** *** 794,795 **** --- 794,797 ---- { /* Add new patch number below this line */ + /**/ + 522, /**/ -- Seen on the back of a biker's vest: If you can read this, my wife fell off. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///