Patch 8.2.2712

2021-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.2712
Problem:Memory leak when adding to a blob fails.
Solution:   Clear the second typval before returning.
Files:  src/eval.c


*** ../vim-8.2.2711/src/eval.c  2021-04-04 20:49:46.626430253 +0200
--- src/eval.c  2021-04-04 21:48:49.921257681 +0200
***
*** 3008,3017 
n1 = tv_get_number_chk(rettv, );
if (error)
{
!   // This can only happen for "list + non-list".  For
!   // "non-list + ..." or "something - ...", we returned
!   // before evaluating the 2nd operand.
clear_tv(rettv);
return FAIL;
}
  #ifdef FEAT_FLOAT
--- 3008,3019 
n1 = tv_get_number_chk(rettv, );
if (error)
{
!   // This can only happen for "list + non-list" or
!   // "blob + non-blob".  For "non-list + ..." or
!   // "something - ...", we returned before evaluating the
!   // 2nd operand.
clear_tv(rettv);
+   clear_tv();
return FAIL;
}
  #ifdef FEAT_FLOAT
*** ../vim-8.2.2711/src/version.c   2021-04-04 21:26:00.948568645 +0200
--- src/version.c   2021-04-04 21:49:05.065219599 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2712,
  /**/

-- 
Over the years, I've developed my sense of deja vu so acutely that now
I can remember things that *have* happened before ...

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104041955.134JtmrJ2882410%40masaka.moolenaar.net.


Patch 8.2.2711

2021-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.2711
Problem:"gj" in a closed fold does not move out of the fold. (Marco Hinz)
Solution:   Add a check for being in a closed fold. (closes #8062)
Files:  src/normal.c, src/testdir/test_fold.vim


*** ../vim-8.2.2710/src/normal.c2021-02-23 19:39:16.761841193 +0100
--- src/normal.c2021-04-04 21:25:11.708675605 +0200
***
*** 2564,2570 
{
if (dir == BACKWARD)
{
!   if ((long)curwin->w_curswant >= width1)
// Move back within the line. This can give a negative value
// for w_curswant if width1 < width2 (with cpoptions+=n),
// which will get clipped to column 0.
--- 2564,2574 
{
if (dir == BACKWARD)
{
!   if ((long)curwin->w_curswant >= width1
! #ifdef FEAT_FOLDING
!   && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)
! #endif
!  )
// Move back within the line. This can give a negative value
// for w_curswant if width1 < width2 (with cpoptions+=n),
// which will get clipped to column 0.
***
*** 2598,2604 
n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;
else
n = width1;
!   if (curwin->w_curswant + width2 < (colnr_T)n)
// move forward within line
curwin->w_curswant += width2;
else
--- 2602,2612 
n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;
else
n = width1;
!   if (curwin->w_curswant + width2 < (colnr_T)n
! #ifdef FEAT_FOLDING
!   && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)
! #endif
!   )
// move forward within line
curwin->w_curswant += width2;
else
*** ../vim-8.2.2710/src/testdir/test_fold.vim   2021-04-01 13:39:47.504992915 
+0200
--- src/testdir/test_fold.vim   2021-04-04 21:23:24.212902447 +0200
***
*** 890,917 
new
set fdm=indent sw=2 wrap tw=80
  
!   let content = [ '  foo', '  bar', '  baz',
!   \   repeat('x',  + 1),
!   \   '  foo', '  bar', '  baz'
\ ]
call append(0, content)
  
normal zM
  
!   call cursor(3, 1)
!   call assert_true(foldclosed(line('.')))
!   normal gj
!   call assert_equal(2, winline())
  
call cursor(2, 1)
call assert_true(foldclosed(line('.')))
normal 2gj
call assert_equal(3, winline())
  
!   call cursor(5, 1)
!   call assert_true(foldclosed(line('.')))
!   normal gk
!   call assert_equal(3, winline())
  
call cursor(6, 1)
call assert_true(foldclosed(line('.')))
--- 890,922 
new
set fdm=indent sw=2 wrap tw=80
  
!   let longtext = repeat('x',  + 1)
!   let content = [ '  foo', '  ' .. longtext, '  baz',
!   \   longtext,
!   \   '  foo', '  ' .. longtext, '  baz'
\ ]
call append(0, content)
  
normal zM
  
!   for lnum in range(1, 3)
! call cursor(lnum, 1)
! call assert_true(foldclosed(line('.')))
! normal gj
! call assert_equal(2, winline())
!   endfor
  
call cursor(2, 1)
call assert_true(foldclosed(line('.')))
normal 2gj
call assert_equal(3, winline())
  
!   for lnum in range(5, 7)
! call cursor(lnum, 1)
! call assert_true(foldclosed(line('.')))
! normal gk
! call assert_equal(3, winline())
!   endfor
  
call cursor(6, 1)
call assert_true(foldclosed(line('.')))
*** ../vim-8.2.2710/src/version.c   2021-04-04 20:49:46.626430253 +0200
--- src/version.c   2021-04-04 21:25:46.924599293 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2711,
  /**/

-- 
Be thankful to be in a traffic jam, because it means you own a car.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104041926.134JQahn2876055%40masaka.moolenaar.net.


Patch 8.2.2710

2021-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.2710
Problem:Vim9: not all tests cover script and :def function.
Solution:   Run tests in both if possible. Fix differences.
Files:  src/eval.c, src/vim9compile.c, src/vim9execute.c,
src/testdir/vim9.vim, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.2709/src/eval.c  2021-03-27 21:23:27.064153032 +0100
--- src/eval.c  2021-04-04 20:18:24.028030100 +0200
***
*** 2330,2336 
{
if (evaluate && vim9script && !VIM_ISWHITE(p[-1]))
{
!   error_white_both(p, 1);
clear_tv(rettv);
return FAIL;
}
--- 2330,2336 
{
if (evaluate && vim9script && !VIM_ISWHITE(p[-1]))
{
!   error_white_both(p, op_falsy ? 2 : 1);
clear_tv(rettv);
return FAIL;
}
***
*** 2361,2367 
++*arg;
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1]))
{
!   error_white_both(p, 1);
clear_tv(rettv);
return FAIL;
}
--- 2361,2367 
++*arg;
if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1]))
{
!   error_white_both(p, op_falsy ? 2 : 1);
clear_tv(rettv);
return FAIL;
}
***
*** 2774,2780 
 */
if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len]))
{
!   error_white_both(p, 1);
clear_tv(rettv);
return FAIL;
}
--- 2774,2780 
 */
if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len]))
{
!   error_white_both(p, len);
clear_tv(rettv);
return FAIL;
}
***
*** 3438,3446 
  case '@': ++*arg;
if (evaluate)
{
!   rettv->v_type = VAR_STRING;
!   rettv->vval.v_string = get_reg_contents(**arg,
!   GREG_EXPR_SRC);
}
if (**arg != NUL)
++*arg;
--- 3438,3453 
  case '@': ++*arg;
if (evaluate)
{
!   if (in_vim9script() && IS_WHITE_OR_NUL(**arg))
!   semsg(_(e_syntax_error_at_str), *arg);
!   else if (in_vim9script() && !valid_yank_reg(**arg, FALSE))
!   emsg_invreg(**arg);
!   else
!   {
!   rettv->v_type = VAR_STRING;
!   rettv->vval.v_string = get_reg_contents(**arg,
!   GREG_EXPR_SRC);
!   }
}
if (**arg != NUL)
++*arg;
*** ../vim-8.2.2709/src/vim9compile.c   2021-04-03 21:47:03.276908544 +0200
--- src/vim9compile.c   2021-04-04 20:39:06.544995935 +0200
***
*** 4106,4112 
ppconst->pp_is_const = FALSE;
  
*arg = p + 1;
!   if (may_get_next_line(*arg, arg, cctx) == FAIL)
{
emsg(_(e_missing_name_after_dot));
return FAIL;
--- 4106,4112 
ppconst->pp_is_const = FALSE;
  
*arg = p + 1;
!   if (IS_WHITE_OR_NUL(**arg))
{
emsg(_(e_missing_name_after_dot));
return FAIL;
***
*** 4785,4791 
if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[2]))
{
semsg(_(e_white_space_required_before_and_after_str_at_str),
!op, *arg);
return FAIL;
}
  
--- 4785,4791 
if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[2]))
{
semsg(_(e_white_space_required_before_and_after_str_at_str),
!   op, p);
return FAIL;
}
  
*** ../vim-8.2.2709/src/vim9execute.c   2021-04-03 19:32:40.750286283 +0200
--- src/vim9execute.c   2021-04-04 16:24:34.958274412 +0200
***
*** 3962,3970 
  
  done:
  // function finished, get result from the stack.
! tv = STACK_TV_BOT(-1);
! *rettv = *tv;
! tv->v_type = VAR_UNKNOWN;
  ret = OK;
  
  failed:
--- 3962,3977 
  
  done:
  // function finished, get result from the stack.
! if (ufunc->uf_ret_type == _void)
! {
!   rettv->v_type = VAR_VOID;
! }
! else
! {
!   tv = STACK_TV_BOT(-1);
!   *rettv = *tv;
!   tv->v_type = VAR_UNKNOWN;
! }
  ret = OK;
  
  failed:
*** ../vim-8.2.2709/src/testdir/vim9.vim2021-01-21 12:34:11.441508288 
+0100
--- src/testdir/vim9.vim2021-04-04 16:58:38.997630294 +0200
***
*** 107,115 
--- 107,135 
CheckScriptFailure(['vim9script'] + lines, error, lnum 

Patch 8.2.2709

2021-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.2709
Problem:The GTK GUI has a gap next to the scrollbar.
Solution:   Calculate the scrollbar padding for GTK. (closes #8027)
Files:  src/gui_gtk.c


*** ../vim-8.2.2708/src/gui_gtk.c   2020-10-21 16:10:16.382485983 +0200
--- src/gui_gtk.c   2021-04-04 15:47:59.216914915 +0200
***
*** 1011,1027 
  int
  gui_mch_get_scrollbar_xpadding(void)
  {
! // TODO: Calculate the padding for adjust scrollbar position when the
! // Window is maximized.
! return 0;
  }
  
  int
  gui_mch_get_scrollbar_ypadding(void)
  {
! // TODO: Calculate the padding for adjust scrollbar position when the
! // Window is maximized.
! return 0;
  }
  
  /*
--- 1011,1039 
  int
  gui_mch_get_scrollbar_xpadding(void)
  {
! int xpad;
! #if GTK_CHECK_VERSION(3,0,0)
! xpad = gtk_widget_get_allocated_width(gui.formwin)
! - gtk_widget_get_allocated_width(gui.drawarea) - gui.scrollbar_width;
! #else
! xpad = gui.formwin->allocation.width - gui.drawarea->allocation.width
!- gui.scrollbar_width;
! #endif
! return (xpad < 0) ? 0 : xpad;
  }
  
  int
  gui_mch_get_scrollbar_ypadding(void)
  {
! int ypad;
! #if GTK_CHECK_VERSION(3,0,0)
! ypad = gtk_widget_get_allocated_height(gui.formwin)
!   - gtk_widget_get_allocated_height(gui.drawarea) - gui.scrollbar_height;
! #else
! ypad = gui.formwin->allocation.height - gui.drawarea->allocation.height
!   - gui.scrollbar_height;
! #endif
! return (ypad < 0) ? 0 : ypad;
  }
  
  /*
*** ../vim-8.2.2708/src/version.c   2021-04-04 15:28:55.509067733 +0200
--- src/version.c   2021-04-04 15:47:13.413069393 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2709,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
56. You leave the modem speaker on after connecting because you think it
sounds like the ocean wind...the perfect soundtrack for "surfing the net".

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104041357.134Dvjlj2801443%40masaka.moolenaar.net.


Patch 8.2.2708

2021-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.2708
Problem:Test sometimes fails waiting for shell in terminal.
Solution:   Use WaitForAssert() so we can see the actual job status.  Use
Run_shell_in_terminal().
Files:  src/testdir/term_util.vim, src/testdir/test_mksession.vim


*** ../vim-8.2.2707/src/testdir/term_util.vim   2021-02-14 13:17:16.992007963 
+0100
--- src/testdir/term_util.vim   2021-04-04 15:28:20.889158957 +0200
***
*** 23,29 
  func StopShellInTerminal(buf)
call term_sendkeys(a:buf, "exit\r")
let job = term_getjob(a:buf)
!   call WaitFor({-> job_status(job) == "dead"})
  endfunc
  
  " Wrapper around term_wait() to allow more time for re-runs of flaky tests
--- 23,29 
  func StopShellInTerminal(buf)
call term_sendkeys(a:buf, "exit\r")
let job = term_getjob(a:buf)
!   call WaitForAssert({-> assert_equal("dead", job_status(job))})
  endfunc
  
  " Wrapper around term_wait() to allow more time for re-runs of flaky tests
***
*** 160,166 
  " number.
  func Run_shell_in_terminal(options)
if has('win32')
! let buf = term_start([,'/k'], a:options)
else
  let buf = term_start(, a:options)
endif
--- 160,166 
  " number.
  func Run_shell_in_terminal(options)
if has('win32')
! let buf = term_start([, '/k'], a:options)
else
  let buf = term_start(, a:options)
endif
*** ../vim-8.2.2707/src/testdir/test_mksession.vim  2021-04-01 
13:39:47.504992915 +0200
--- src/testdir/test_mksession.vim  2021-04-04 15:26:34.261439924 +0200
***
*** 392,398 
  func Test_mksession_terminal_no_restore_funcarg()
CheckFeature terminal
  
!   call term_start(, {'norestore': 1})
mksession! Xtest_mks.out
let lines = readfile('Xtest_mks.out')
let term_cmd = ''
--- 392,398 
  func Test_mksession_terminal_no_restore_funcarg()
CheckFeature terminal
  
!   let buf = Run_shell_in_terminal({'norestore': 1})
mksession! Xtest_mks.out
let lines = readfile('Xtest_mks.out')
let term_cmd = ''
***
*** 402,408 
  endif
endfor
  
!   call StopShellInTerminal(bufnr('%'))
call delete('Xtest_mks.out')
  endfunc
  
--- 402,408 
  endif
endfor
  
!   call StopShellInTerminal(buf)
call delete('Xtest_mks.out')
  endfunc
  
*** ../vim-8.2.2707/src/version.c   2021-04-04 15:05:16.784805937 +0200
--- src/version.c   2021-04-04 15:23:34.317914103 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2708,
  /**/

-- 
Keyboard not found.  Think ENTER to continue.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104041329.134DTULg2789325%40masaka.moolenaar.net.


Patch 8.2.2707

2021-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.2707 (after 8.2.2704)
Problem:Adding a lot of completions can still be a bit slow.
Solution:   Add the check for CP_FAST. (Ben Jackson)
Files:  src/insexpand.c


*** ../vim-8.2.2706/src/insexpand.c 2021-04-03 20:13:25.590782472 +0200
--- src/insexpand.c 2021-04-04 15:04:58.760853416 +0200
***
*** 586,592 
  int   dir = (cdir == 0 ? compl_direction : cdir);
  int   flags = flags_arg;
  
! ui_breakcheck();
  if (got_int)
return FAIL;
  if (len < 0)
--- 586,595 
  int   dir = (cdir == 0 ? compl_direction : cdir);
  int   flags = flags_arg;
  
! if (flags & CP_FAST)
!   fast_breakcheck();
! else
!   ui_breakcheck();
  if (got_int)
return FAIL;
  if (len < 0)
*** ../vim-8.2.2706/src/version.c   2021-04-03 21:47:03.276908544 +0200
--- src/version.c   2021-04-04 13:24:57.272225427 +0200
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 2707,
  /**/

-- 
"I simultaneously try to keep my head in the clouds and my feet on the
ground.  Sometimes it's a stretch, though."  -- Larry Wall

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104041306.134D6hFN2784368%40masaka.moolenaar.net.


Re: [patch] doc fixes

2021-04-04 Fir de Conversatie Bram Moolenaar


Dominique wrote:

> Attached patch fixes a few typos in vim-8.2.2706 doc.

Thanks.

-- 
hundred-and-one symptoms of being an internet addict:
54. You start tilting your head sideways to smile. :-)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104041106.134B62xj2760672%40masaka.moolenaar.net.