Patch 8.2.0806

2020-05-21 Fir de Conversatie Bram Moolenaar


Patch 8.2.0806
Problem:using "func!" after vim9script gives confusing error.
Solution:   Give E477. (closes #6107)
Files:  src/vim9script.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.0805/src/vim9script.c2020-05-15 18:17:24.590759529 +0200
--- src/vim9script.c2020-05-21 21:46:00.957620751 +0200
***
*** 84,89 
--- 84,95 
{
int lnum_start = SOURCING_LNUM - 1;
  
+   if (*p == '!')
+   {
+   emsg(_(e_nobang));
+   break;
+   }
+ 
// Handle :function and :def by calling def_function().
// It will read upto the matching :endded or :endfunction.
eap->cmdidx = *line == 'f' ? CMD_function : CMD_def;
*** ../vim-8.2.0805/src/testdir/test_vim9_script.vim2020-05-18 
14:20:33.915289768 +0200
--- src/testdir/test_vim9_script.vim2020-05-21 21:49:21.572957619 +0200
***
*** 136,142 
let dict2: dict = #{one: 1, two: 2}
let dict3: dict = #{key: 'value'}
let dict4: dict = #{one: 1, two: '2'}
!   let dict5: dict = #{one: 0z01, tw: 0z02}
  
call CheckDefExecFailure(['let dd = {}', 'dd[""] = 6'], 'E713:')
  
--- 136,142 
let dict2: dict = #{one: 1, two: 2}
let dict3: dict = #{key: 'value'}
let dict4: dict = #{one: 1, two: '2'}
!   let dict5: dict = #{one: 0z01, two: 0z02}
  
call CheckDefExecFailure(['let dd = {}', 'dd[""] = 6'], 'E713:')
  
***
*** 1721,1726 
--- 1721,1731 
'dsearch /pat/#comment',
'bwipe!',
], 'E488:')
+ 
+   CheckScriptFailure([
+   'vim9script',
+   'func! SomeFunc()',
+   ], 'E477:')
  enddef
  
  def Test_finish()
*** ../vim-8.2.0805/src/version.c   2020-05-21 20:38:28.039879979 +0200
--- src/version.c   2020-05-21 21:47:46.261272610 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 806,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
151. You find yourself engaged to someone you've never actually met,
 except through e-mail.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
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/202005211951.04LJpWUh020103%40masaka.moolenaar.net.


Patch 8.2.0805

2020-05-21 Fir de Conversatie Bram Moolenaar


Patch 8.2.0805
Problem:Terminal key codes test fails on some systems.
Solution:   Skip keypad 3 and 9. (Yegappan Lakshmanan, closes #6070)
Files:  src/testdir/test_terminal.vim


*** ../vim-8.2.0804/src/testdir/test_terminal.vim   2020-05-18 
19:46:00.074602945 +0200
--- src/testdir/test_terminal.vim   2020-05-21 20:36:56.528125201 +0200
***
*** 2683,2704 
  \ '', '', '', '', '', '', '',
  \ '', '', '', '', '', '',
  \ '', '', '', '', '',
! \ '', '', '', '', '',
! \ '0123456789', "\t\t.+-*/"]
  
!   for k in keys
! call term_sendkeys(buf, "i\" .. k .. "\\\")
endfor
-   call term_sendkeys(buf, "i")
-   call term_sendkeys(buf, "\")
-   call term_sendkeys(buf, "\")
-   call term_sendkeys(buf, "\\")
  
!   call term_sendkeys(buf, ":write Xkeycodes\")
call term_wait(buf)
call StopVimInTerminal(buf)
-   call assert_equal(output, readfile('Xkeycodes'))
-   call delete('Xkeycodes')
  endfunc
  
  " Test for using the mouse in a terminal
--- 2683,2727 
  \ '', '', '', '', '', '', '',
  \ '', '', '', '', '', '',
  \ '', '', '', '', '',
! \ '', '', '', '', '']
  
!   call term_sendkeys(buf, "i")
!   for i in range(len(keys))
! call term_sendkeys(buf, "\\" .. keys[i])
! call term_wait(buf)
! call assert_equal(output[i], term_getline(buf, 1))
endfor
  
!   "call term_sendkeys(buf, 
"\\")
!   "call term_sendkeys(buf, "\\\")
!   "call term_sendkeys(buf, "\\\")
!   "call term_sendkeys(buf, "\")
!   "call term_sendkeys(buf, "")
!   "call term_sendkeys(buf, "\")
! 
!   "call term_sendkeys(buf, ":write Xkeycodes\")
!   
!   let keypad_keys = ["\", "\", "\", "\", "\", "\",
! \ "\", "\", "\", "\", "\", "\",
! \ "\", "\", "\"]
!   let keypad_output = ['0', '1', '2', '3', '4', '5',
! \ '6', '7', '8', '9', '.', '+',
! \ '-', '*', '/']
!   for i in range(len(keypad_keys))
! " TODO: Mysteriously keypad 3 and 9 do not work on some systems.
! if keypad_output[i] == '3' || keypad_output[i] == '9'
!   continue
! endif
! call term_sendkeys(buf, "\" .. keypad_keys[i])
! call term_wait(buf)
! call assert_equal(keypad_output[i], term_getline(buf, 1))
!   endfor
! 
!   call feedkeys("\\\one\.two", 'xt')
call term_wait(buf)
+   call assert_equal('two', term_getline(buf, 1))
+ 
call StopVimInTerminal(buf)
  endfunc
  
  " Test for using the mouse in a terminal
*** ../vim-8.2.0804/src/version.c   2020-05-21 20:10:00.289336748 +0200
--- src/version.c   2020-05-21 20:28:48.085294840 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 805,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
150. You find yourself counting emoticons to get to sleep.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
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/202005211839.04LIdxQn000991%40masaka.moolenaar.net.


Patch 8.2.0804

2020-05-21 Fir de Conversatie Bram Moolenaar


Patch 8.2.0804
Problem:Libvterm code lags behind the upstream version.
Solution:   Include revision 727, but add the index instead of switching
between RGB and indexed.
Files:  src/terminal.c, src/term.c, src/libvterm/include/vterm.h,
src/libvterm/src/pen.c src/libvterm/src/screen.c
src/libvterm/src/vterm_internal.h src/libvterm/t/30state_pen.test
src/libvterm/t/harness.c, src/libvterm/src/state.c,
src/libvterm/t/26state_query.test,
src/libvterm/t/64screen_pen.test

*** ../vim-8.2.0803/src/terminal.c  2020-05-20 18:41:37.157258608 +0200
--- src/terminal.c  2020-05-21 20:03:17.583039565 +0200
***
*** 1626,1632 
  static int
  equal_celattr(cellattr_T *a, cellattr_T *b)
  {
! // Comparing the colors should be sufficient.
  return a->fg.red == b->fg.red
&& a->fg.green == b->fg.green
&& a->fg.blue == b->fg.blue
--- 1626,1633 
  static int
  equal_celattr(cellattr_T *a, cellattr_T *b)
  {
! // We only compare the RGB colors, ignoring the ANSI index and type.
! // Thus black set explicitly is equal the background black.
  return a->fg.red == b->fg.red
&& a->fg.green == b->fg.green
&& a->fg.blue == b->fg.blue
***
*** 2692,2701 
  int blue = color->blue;
  int green = color->green;
  
! if (color->ansi_index != VTERM_ANSI_INDEX_NONE)
  {
// The first 16 colors and default: use the ANSI index.
!   switch (color->ansi_index)
{
case  0: return 0;
case  1: return lookup_color( 0, fg, boldp) + 1; // black
--- 2693,2705 
  int blue = color->blue;
  int green = color->green;
  
! if (VTERM_COLOR_IS_DEFAULT_FG(color)
!   || VTERM_COLOR_IS_DEFAULT_BG(color))
!   return 0;
! if (VTERM_COLOR_IS_INDEXED(color))
  {
// The first 16 colors and default: use the ANSI index.
!   switch (color->index + 1)
{
case  0: return 0;
case  1: return lookup_color( 0, fg, boldp) + 1; // black
***
*** 3832,3838 
  static void
  cterm_color2vterm(int nr, VTermColor *rgb)
  {
! cterm_color2rgb(nr, >red, >green, >blue, >ansi_index);
  }
  
  /*
--- 3836,3849 
  static void
  cterm_color2vterm(int nr, VTermColor *rgb)
  {
! cterm_color2rgb(nr, >red, >green, >blue, >index);
! if (rgb->index == 0)
!   rgb->type = VTERM_COLOR_RGB;
! else
! {
!   rgb->type = VTERM_COLOR_INDEXED;
!   --rgb->index;
! }
  }
  
  /*
***
*** 3864,3870 
  }
  fg->red = fg->green = fg->blue = fgval;
  bg->red = bg->green = bg->blue = bgval;
! fg->ansi_index = bg->ansi_index = VTERM_ANSI_INDEX_DEFAULT;
  
  // The 'wincolor' or the highlight group overrules the defaults.
  if (wp != NULL && *wp->w_p_wcr != NUL)
--- 3875,3882 
  }
  fg->red = fg->green = fg->blue = fgval;
  bg->red = bg->green = bg->blue = bgval;
! fg->type = VTERM_COLOR_RGB | VTERM_COLOR_DEFAULT_FG;
! bg->type = VTERM_COLOR_RGB | VTERM_COLOR_DEFAULT_BG;
  
  // The 'wincolor' or the highlight group overrules the defaults.
  if (wp != NULL && *wp->w_p_wcr != NUL)
***
*** 4509,4529 
  return buf;
  }
  
! static int
! same_color(VTermColor *a, VTermColor *b)
  {
! return a->red == b->red
!   && a->green == b->green
!   && a->blue == b->blue
!   && a->ansi_index == b->ansi_index;
  }
  
  static void
  dump_term_color(FILE *fd, VTermColor *color)
  {
  fprintf(fd, "%02x%02x%02x%d",
(int)color->red, (int)color->green, (int)color->blue,
!   (int)color->ansi_index);
  }
  
  /*
--- 4521,4550 
  return buf;
  }
  
! static void
! clear_cell(VTermScreenCell *cell)
  {
! CLEAR_FIELD(*cell);
! cell->fg.type = VTERM_COLOR_DEFAULT_FG;
! cell->bg.type = VTERM_COLOR_DEFAULT_BG;
  }
  
  static void
  dump_term_color(FILE *fd, VTermColor *color)
  {
+ int index;
+ 
+ if (VTERM_COLOR_IS_INDEXED(color))
+   index = color->index + 1;
+ else if (color->type == 0)
+   // use RGB values
+   index = 255;
+ else
+   // default color
+   index = 0;
  fprintf(fd, "%02x%02x%02x%d",
(int)color->red, (int)color->green, (int)color->blue,
!   index);
  }
  
  /*
***
*** 4607,4613 
return;
  }
  
! CLEAR_FIELD(prev_cell);
  
  screen = vterm_obtain_screen(term->tl_vterm);
  state = vterm_obtain_state(term->tl_vterm);
--- 4628,4634 
return;
  }
  
! clear_cell(_cell);
  
  screen = vterm_obtain_screen(term->tl_vterm);
  state = vterm_obtain_state(term->tl_vterm);
***
*** 4629,4635 
 && pos.row == cursor_pos.row);
  
if (vterm_screen_get_cell(screen, pos, ) == 0)
!   

Re: [vim/vim] Failed test 'test_terminal.vim' after patch 8.2.0738 (#6070)

2020-05-21 Fir de Conversatie Elimar Riesebieter
* Vladimir Lomov  [2020-05-20 21:32 -0700]:

> Hello Yegappan,
> I tested this version of `Test_term_keycode_translation` and I got
> ```
> Failures: 
> From test_terminal.vim:
> Found errors in Test_term_keycode_translation():
> Run 1:
> function RunTheTest[39]..Test_term_keycode_translation line 33: 
> Expected '3' but got ''
> function RunTheTest[39]..Test_term_keycode_translation line 33: 
> Expected '9' but got ''
> Run 2:
> function RunTheTest[39]..Test_term_keycode_translation line 33: 
> Expected '3' but got ''
> function RunTheTest[39]..Test_term_keycode_translation line 33: 
> Expected '9' but got ''
> Flaky test failed too often, giving up
> ```
> when ran `TERM=xterm make -j1 test` in `.../vim/src`. I used vim from commit 
> [patch 8.2.0803: libvterm code lags behind the upstream 
> version](https://github.com/vim/vim/commit/83a52533b23c88f90be0dea01bc5e32ddadc1d6a)

Same here:
tmux in an urxvt
ssh remote
TERM=tmux-256color

Elimar
-- 
BOFH excuse #398:
Data for intranet got routed through the extranet and landed on the internet.

-- 
-- 
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/20200521114458.uzy3t2bjonbvgr5k%40toy.home.lxtec.de.