Patch 8.0.1848
Problem:    'termwinscroll' does not work properly. (Dominique Pelle)
Solution:   Subtract removed scrollback from the scrollback count.  Add a test
            for 'termwinscroll'. (closes #2909)
Files:      src/terminal.c, src/testdir/test_terminal.vim


*** ../vim-8.0.1847/src/terminal.c      2018-05-13 19:06:06.527783867 +0200
--- src/terminal.c      2018-05-15 23:50:25.665785853 +0200
***************
*** 46,51 ****
--- 46,52 ----
   * - Win32: Redirecting output works but includes escape sequences.
   * - Win32: Make terminal used for :!cmd in the GUI work better.  Allow for
   *   redirection.
+  * - terminal API: Add more functionality? (Ozaki Kiichi 2018 May 13, #2907)
   * - When the job only outputs lines, we could handle resizing the terminal
   *   better: store lines separated by line breaks, instead of screen lines,
   *   then when the window is resized redraw those lines.
***************
*** 2727,2732 ****
--- 2728,2734 ----
        mch_memmove(term->tl_scrollback.ga_data,
            (sb_line_T *)term->tl_scrollback.ga_data + todo,
            sizeof(sb_line_T) * term->tl_scrollback.ga_len);
+       term->tl_scrollback_scrolled -= todo;
      }
  
      if (ga_grow(&term->tl_scrollback, 1) == OK)
*** ../vim-8.0.1847/src/testdir/test_terminal.vim       2018-05-12 
21:12:07.823426407 +0200
--- src/testdir/test_terminal.vim       2018-05-15 23:48:29.726245835 +0200
***************
*** 1507,1509 ****
--- 1507,1536 ----
    call delete('Xechoerrout.sh')
    call delete(outfile)
  endfunc
+ 
+ func Test_terminwinscroll()
+   if !has('unix')
+     return
+   endif
+ 
+   " Let the terminal output more than 'termwinscroll' lines, some at the start
+   " will be dropped.
+   exe 'set termwinscroll=' . &lines
+   let buf = term_start('/bin/sh')
+   for i in range(1, &lines)
+     call feedkeys("echo " . i . "\<CR>", 'xt')
+     call WaitForAssert({-> assert_match(string(i), term_getline(buf, 
term_getcursor(buf)[0] - 1))})
+   endfor
+   " Go to Terminal-Normal mode to update the buffer.
+   call feedkeys("\<C-W>N", 'xt')
+   call assert_inrange(&lines, &lines * 110 / 100 + winheight(0), line('$'))
+ 
+   " Every "echo nr" must only appear once
+   let lines = getline(1, line('$'))
+   for i in range(&lines - len(lines) / 2 + 2, &lines)
+     let filtered = filter(copy(lines), {idx, val -> val =~ 'echo ' . i . 
'\>'})
+     call assert_equal(1, len(filtered), 'for "echo ' . i . '"')
+   endfor
+ 
+   exe buf . 'bwipe!'
+ endfunc
*** ../vim-8.0.1847/src/version.c       2018-05-15 22:34:54.631170392 +0200
--- src/version.c       2018-05-15 23:52:37.993201195 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1848,
  /**/

-- 
Violators can be fined, arrested or jailed for making ugly faces at a dog.
                [real standing law in Oklahoma, United States of America]

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui