Re: Patch 8.2.4684

2022-04-04 Fir de Conversatie 7to...@gmail.com
> This was probably meant to be "port", not "pair".

It was probably meant to be "path", not "pair", nor "port". Correcting the 
correction :-)

Tom


-- 
-- 
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/fc354ff2-713b-4ae4-88dd-dfeb6bc2cac1n%40googlegroups.com.


Patch 8.2.4691

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4691 (after 8.2.4689)
Problem:Solution for  in a mapping causes trouble.
Solution:   Use another solution: put back CTRL-O after reading the 
sequence.
Files:  src/getchar.c


*** ../vim-8.2.4690/src/getchar.c   2022-04-04 21:03:49.180834694 +0100
--- src/getchar.c   2022-04-04 22:07:30.619451549 +0100
***
*** 96,105 
  static intvgetorpeek(int);
  static intinchar(char_u *buf, int maxlen, long wait_time);
  
- // flags for vgetorpeek()
- #define VGOP_ADVANCE  1   // really get the character
- #define VGOP_NO_STUFF 2   // do not use the stuff buffer
- 
  /*
   * Free and clear a buffer.
   */
--- 96,101 
***
*** 1724,1730 
++allow_keys;
did_inc = TRUE; // mod_mask may change value
}
!   c = vgetorpeek(VGOP_ADVANCE);
if (did_inc)
{
--no_mapping;
--- 1720,1726 
++allow_keys;
did_inc = TRUE; // mod_mask may change value
}
!   c = vgetorpeek(TRUE);
if (did_inc)
{
--no_mapping;
***
*** 1742,1749 
  
++no_mapping;
allow_keys = 0; // make sure BS is not found
!   c2 = vgetorpeek(VGOP_ADVANCE);  // no mapping for these chars
!   c = vgetorpeek(VGOP_ADVANCE);
--no_mapping;
allow_keys = save_allow_keys;
if (c2 == KS_MODIFIER)
--- 1738,1745 
  
++no_mapping;
allow_keys = 0; // make sure BS is not found
!   c2 = vgetorpeek(TRUE);  // no mapping for these chars
!   c = vgetorpeek(TRUE);
--no_mapping;
allow_keys = save_allow_keys;
if (c2 == KS_MODIFIER)
***
*** 1766,1772 
int j;
  
// get menu path, it ends with a 
!   for (j = 0; (c = vgetorpeek(VGOP_ADVANCE)) != '\r'; )
{
name[j] = c;
if (j < 199)
--- 1762,1768 
int j;
  
// get menu path, it ends with a 
!   for (j = 0; (c = vgetorpeek(TRUE)) != '\r'; )
{
name[j] = c;
if (j < 199)
***
*** 1876,1882 
buf[0] = c;
for (i = 1; i < n; ++i)
{
!   buf[i] = vgetorpeek(VGOP_ADVANCE);
if (buf[i] == K_SPECIAL
  #ifdef FEAT_GUI
|| (buf[i] == CSI)
--- 1872,1878 
buf[0] = c;
for (i = 1; i < n; ++i)
{
!   buf[i] = vgetorpeek(TRUE);
if (buf[i] == K_SPECIAL
  #ifdef FEAT_GUI
|| (buf[i] == CSI)
***
*** 1889,1896 
// represents a CSI (0x9B),
// or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
!   c = vgetorpeek(VGOP_ADVANCE);
!   if (vgetorpeek(VGOP_ADVANCE) == KE_CSI && c == KS_EXTRA)
buf[i] = CSI;
}
}
--- 1885,1892 
// represents a CSI (0x9B),
// or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
!   c = vgetorpeek(TRUE);
!   if (vgetorpeek(TRUE) == KE_CSI && c == KS_EXTRA)
buf[i] = CSI;
}
}
***
*** 1993,1999 
  {
  if (old_char != -1)
return old_char;
! return vgetorpeek(0);
  }
  
  #if defined(FEAT_TERMRESPONSE) || defined(FEAT_TERMINAL) || defined(PROTO)
--- 1989,1995 
  {
  if (old_char != -1)
return old_char;
! return vgetorpeek(FALSE);
  }
  
  #if defined(FEAT_TERMRESPONSE) || defined(FEAT_TERMINAL) || defined(PROTO)
***
*** 2968,2978 
   * 3. from the user
   *This may do a blocking wait if "advance" is TRUE.
   *
!  * if "flags & VGOP_ADVANCE" is non-zero (vgetc()):
   *Really get the character.
   *KeyTyped is set to TRUE in the case the user typed the key.
   *KeyStuffed is TRUE if the character comes from the stuff buffer.
!  * if "flags & VGOP_ADVANCE" is zero (vpeekc()):
   *Just look whether there is a character available.
   *Return NUL if not.
   *
--- 2964,2974 
   * 3. from the user
   *This may do a blocking wait if "advance" is TRUE.
   *
!  * if "advance" is TRUE (vgetc()):
   *Really get the character.
   *KeyTyped is set to TRUE in the case the user typed the key.
   *KeyStuffed is TRUE if the character comes from the stuff buffer.
!  * if

Re: Patch 8.2.4684

2022-04-04 Fir de Conversatie 7to...@gmail.com
> ***
> *** 579,588 
> --- 582,596 
>   When opened with ch_open():
>  "hostname"  the hostname of the address
>  "port"  the port of the address
> +"path"  the path of the Unix-domain socket
>  "sock_status"  "open" or "closed"
>  "sock_mode"  "NL", "RAW", "JSON" or "JS"
>  "sock_io"  "socket"
>  "sock_timeout" timeout in msec
> + 
> + Note that "pair" is only present for Unix-domain sockets, for

This was probably meant to be "port", not "pair".

Tom


-- 
-- 
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/f31324ba-1366-4846-a991-3588c473a272n%40googlegroups.com.


Patch 8.2.4690

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4690
Problem:Channel tests fail on MS-Windows.
Solution:   Check if the AF_UNIX attribute exists. (closes #10083)
Files:  src/testdir/test_channel.py, src/testdir/test_channel_unix.py


*** ../vim-8.2.4689/src/testdir/test_channel.py 2022-04-04 15:46:37.606126838 
+0100
--- src/testdir/test_channel.py 2022-04-04 21:09:49.800215297 +0100
***
*** 19,30 
  # Python 2
  import SocketServer as socketserver
  
! class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
! 
! def setup(self):
! if self.server.address_family != socket.AF_UNIX:
! self.request.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
! 
  def handle(self):
  print("=== socket opened ===")
  while True:
--- 19,25 
  # Python 2
  import SocketServer as socketserver
  
! class TestingRequestHandler(socketserver.BaseRequestHandler):
  def handle(self):
  print("=== socket opened ===")
  while True:
***
*** 240,245 
--- 235,244 
  elif decoded[0] < 0:
  last_eval = decoded
  
+ class ThreadedTCPRequestHandler(TestingRequestHandler):
+ def setup(self):
+ self.request.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
+ 
  class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
  pass
  
*** ../vim-8.2.4689/src/testdir/test_channel_unix.py2022-04-04 
15:46:37.606126838 +0100
--- src/testdir/test_channel_unix.py2022-04-04 21:09:49.800215297 +0100
***
*** 6,12 
  # This requires Python 2.6 or later.
  
  from __future__ import print_function
! from test_channel import ThreadedTCPServer, ThreadedTCPRequestHandler, \
  writePortInFile
  import socket
  import threading
--- 6,12 
  # This requires Python 2.6 or later.
  
  from __future__ import print_function
! from test_channel import ThreadedTCPServer, TestingRequestHandler, \
  writePortInFile
  import socket
  import threading
***
*** 18,28 
  # Python 2
  FileNotFoundError = (IOError, OSError)
  
  class ThreadedUnixServer(ThreadedTCPServer):
  address_family = socket.AF_UNIX
  
  def main(path):
! server = ThreadedUnixServer(path, ThreadedTCPRequestHandler)
  
  # Start a thread with the server.  That thread will then start a new 
thread
  # for each connection.
--- 18,34 
  # Python 2
  FileNotFoundError = (IOError, OSError)
  
+ if not hasattr(socket, "AF_UNIX"):
+ raise NotImplementedError("Unix sockets are not supported on this 
platform")
+ 
  class ThreadedUnixServer(ThreadedTCPServer):
  address_family = socket.AF_UNIX
  
+ class ThreadedUnixRequestHandler(TestingRequestHandler):
+ pass
+ 
  def main(path):
! server = ThreadedUnixServer(path, ThreadedUnixRequestHandler)
  
  # Start a thread with the server.  That thread will then start a new 
thread
  # for each connection.
*** ../vim-8.2.4689/src/version.c   2022-04-04 21:03:49.180834694 +0100
--- src/version.c   2022-04-04 21:13:16.803905872 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4690,
  /**/

-- 
Citizens are not allowed to attend a movie house or theater nor ride in a
public streetcar within at least four hours after eating garlic.
[real standing law in Indiana, United States of America]

 /// 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/20220404201416.2A36A1C0561%40moolenaar.net.


Patch 8.2.4689

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4689
Problem:Using  in a mapping does not work for mouse keys in Insert
mode. (Sergey Vlasov)
Solution:   When reading the  argument do not use the stuff buffer.
(closes #10080)
Files:  src/getchar.c


*** ../vim-8.2.4688/src/getchar.c   2022-03-18 15:41:13.366489671 +
--- src/getchar.c   2022-04-04 19:31:42.767169110 +0100
***
*** 96,101 
--- 96,105 
  static intvgetorpeek(int);
  static intinchar(char_u *buf, int maxlen, long wait_time);
  
+ // flags for vgetorpeek()
+ #define VGOP_ADVANCE  1   // really get the character
+ #define VGOP_NO_STUFF 2   // do not use the stuff buffer
+ 
  /*
   * Free and clear a buffer.
   */
***
*** 1720,1726 
++allow_keys;
did_inc = TRUE; // mod_mask may change value
}
!   c = vgetorpeek(TRUE);
if (did_inc)
{
--no_mapping;
--- 1724,1730 
++allow_keys;
did_inc = TRUE; // mod_mask may change value
}
!   c = vgetorpeek(VGOP_ADVANCE);
if (did_inc)
{
--no_mapping;
***
*** 1738,1745 
  
++no_mapping;
allow_keys = 0; // make sure BS is not found
!   c2 = vgetorpeek(TRUE);  // no mapping for these chars
!   c = vgetorpeek(TRUE);
--no_mapping;
allow_keys = save_allow_keys;
if (c2 == KS_MODIFIER)
--- 1742,1749 
  
++no_mapping;
allow_keys = 0; // make sure BS is not found
!   c2 = vgetorpeek(VGOP_ADVANCE);  // no mapping for these chars
!   c = vgetorpeek(VGOP_ADVANCE);
--no_mapping;
allow_keys = save_allow_keys;
if (c2 == KS_MODIFIER)
***
*** 1762,1768 
int j;
  
// get menu path, it ends with a 
!   for (j = 0; (c = vgetorpeek(TRUE)) != '\r'; )
{
name[j] = c;
if (j < 199)
--- 1766,1772 
int j;
  
// get menu path, it ends with a 
!   for (j = 0; (c = vgetorpeek(VGOP_ADVANCE)) != '\r'; )
{
name[j] = c;
if (j < 199)
***
*** 1872,1878 
buf[0] = c;
for (i = 1; i < n; ++i)
{
!   buf[i] = vgetorpeek(TRUE);
if (buf[i] == K_SPECIAL
  #ifdef FEAT_GUI
|| (buf[i] == CSI)
--- 1876,1882 
buf[0] = c;
for (i = 1; i < n; ++i)
{
!   buf[i] = vgetorpeek(VGOP_ADVANCE);
if (buf[i] == K_SPECIAL
  #ifdef FEAT_GUI
|| (buf[i] == CSI)
***
*** 1885,1892 
// represents a CSI (0x9B),
// or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
!   c = vgetorpeek(TRUE);
!   if (vgetorpeek(TRUE) == KE_CSI && c == KS_EXTRA)
buf[i] = CSI;
}
}
--- 1889,1896 
// represents a CSI (0x9B),
// or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
!   c = vgetorpeek(VGOP_ADVANCE);
!   if (vgetorpeek(VGOP_ADVANCE) == KE_CSI && c == KS_EXTRA)
buf[i] = CSI;
}
}
***
*** 1989,1995 
  {
  if (old_char != -1)
return old_char;
! return vgetorpeek(FALSE);
  }
  
  #if defined(FEAT_TERMRESPONSE) || defined(FEAT_TERMINAL) || defined(PROTO)
--- 1993,1999 
  {
  if (old_char != -1)
return old_char;
! return vgetorpeek(0);
  }
  
  #if defined(FEAT_TERMRESPONSE) || defined(FEAT_TERMINAL) || defined(PROTO)
***
*** 2964,2974 
   * 3. from the user
   *This may do a blocking wait if "advance" is TRUE.
   *
!  * if "advance" is TRUE (vgetc()):
   *Really get the character.
   *KeyTyped is set to TRUE in the case the user typed the key.
   *KeyStuffed is TRUE if the character comes from the stuff buffer.
!  * if "advance" is FALSE (vpeekc()):
   *Just look whether there is a character available.
   *Return NUL if not.
   *
--- 2968,2978 
   * 3. from the user
   *This may do a blocking wait if "advance" is TRUE.
   *
!  * if "flags & VGOP_ADVANCE" is non-zero (vgetc()):
   *Really get the character.
   *KeyTyped is set to TRUE in the case the user typed the key.
   *KeyStuffed is TRUE if the character comes from

Patch 8.2.4688

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4688
Problem:New regexp engine does not give an error for "\%v".
Solution:   Check for a value argument. (issue #10079)
Files:  src/regexp_nfa.c, src/errors.h, src/regexp_bt.c,
src/testdir/test_regexp_latin.vim


*** ../vim-8.2.4687/src/regexp_nfa.c2022-03-30 10:57:36.735346197 +0100
--- src/regexp_nfa.c2022-04-04 18:13:02.941458492 +0100
***
*** 1654,1660 
  
if (cur)
{
!   semsg(_(e_regexp_number_after_dot_pos_search),
  no_Magic(c));
return FAIL;
}
--- 1654,1660 
  
if (cur)
{
!   
semsg(_(e_regexp_number_after_dot_pos_search_chr),
  no_Magic(c));
return FAIL;
}
***
*** 1673,1678 
--- 1673,1684 
{
long_u limit = INT_MAX;
  
+   if (!cur && n == 0)
+   {
+   semsg(_(e_nfa_regexp_missing_value_in_chr),
+ no_Magic(c));
+   return FAIL;
+   }
if (c == 'l')
{
if (cur)
*** ../vim-8.2.4687/src/errors.h2022-03-31 11:37:54.259367941 +0100
--- src/errors.h2022-04-04 18:11:37.281351373 +0100
***
*** 3082,3088 
  EXTERN char e_dot_can_only_be_used_on_dictionary_str[]
INIT(= N_("E1203: Dot can only be used on a dictionary: %s"));
  #endif
! EXTERN char e_regexp_number_after_dot_pos_search[]
INIT(= N_("E1204: No Number allowed after .: '\\%%%c'"));
  EXTERN char e_no_white_space_allowed_between_option_and[]
INIT(= N_("E1205: No white space allowed between option and"));
--- 3082,3088 
  EXTERN char e_dot_can_only_be_used_on_dictionary_str[]
INIT(= N_("E1203: Dot can only be used on a dictionary: %s"));
  #endif
! EXTERN char e_regexp_number_after_dot_pos_search_chr[]
INIT(= N_("E1204: No Number allowed after .: '\\%%%c'"));
  EXTERN char e_no_white_space_allowed_between_option_and[]
INIT(= N_("E1205: No white space allowed between option and"));
***
*** 3256,3258 
--- 3256,3260 
  EXTERN char e_using_type_not_in_script_context_str[]
INIT(= N_("E1272: Using type not in a script context: %s"));
  #endif
+ EXTERN char e_nfa_regexp_missing_value_in_chr[]
+   INIT(= N_("E1273: (NFA regexp) missing value in '\\%%%c'"));
*** ../vim-8.2.4687/src/regexp_bt.c 2022-03-29 13:24:49.195974887 +0100
--- src/regexp_bt.c 2022-04-04 18:12:52.389446557 +0100
***
*** 1649,1655 
  {
  if (cur && n)
  {
!   
semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c));
rc_did_emsg = TRUE;
return NULL;
  }
--- 1649,1656 
  {
  if (cur && n)
  {
!   
semsg(_(e_regexp_number_after_dot_pos_search_chr),
! no_Magic(c));
rc_did_emsg = TRUE;
return NULL;
  }
*** ../vim-8.2.4687/src/testdir/test_regexp_latin.vim   2022-03-29 
13:24:49.195974887 +0100
--- src/testdir/test_regexp_latin.vim   2022-04-04 18:31:30.673685137 +0100
***
*** 91,96 
--- 91,108 
set re=0
  endfunc
  
+ func Test_column_failure()
+   set re=1
+   call assert_fails('/\%v', 'E71:')
+   call assert_fails('/\%c', 'E71:')
+   call assert_fails('/\%l', 'E71:')
+   set re=2
+   call assert_fails('/\%v', 'E1273:')
+   call assert_fails('/\%c', 'E1273:')
+   call assert_fails('/\%l', 'E1273:')
+   set re=0
+ endfunc
+ 
  func Test_recursive_addstate()
" This will call addstate() recursively until it runs into the limit.
let lnum = search('\v((){328}){389}')
*** ../vim-8.2.4687/src/version.c   2022-04-04 18:14:30.237544867 +0100
--- src/version.c   2022-04-04 18:31:48.001680800 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4688,
  /**/

-- 
Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke
Any sufficiently advanced bug is indistinguishabl

Patch 8.2.4687

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4687
Problem:"vimgrep /\%v/ *" may cause a crash.
Solution:   When compiling the pattern with the old engine fails, restore the
regprog of the new engine instead of leaving it NULL.
(closes #10079)
Files:  src/regexp.c


*** ../vim-8.2.4686/src/regexp.c2022-02-16 19:24:03.626162408 +
--- src/regexp.c2022-04-04 17:48:43.869248025 +0100
***
*** 2874,2882 
char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern);
  
p_re = BACKTRACKING_ENGINE;
-   vim_regfree(rmp->regprog);
if (pat != NULL)
{
  #ifdef FEAT_EVAL
report_re_switch(pat);
  #endif
--- 2874,2883 
char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern);
  
p_re = BACKTRACKING_ENGINE;
if (pat != NULL)
{
+   regprog_T *prev_prog = rmp->regprog;
+ 
  #ifdef FEAT_EVAL
report_re_switch(pat);
  #endif
***
*** 2889,2897 
  #ifdef FEAT_SYN_HL
reg_do_extmatch = 0;
  #endif
! 
!   if (rmp->regprog != NULL)
{
rmp->regprog->re_in_use = TRUE;
result = rmp->regprog->engine->regexec_multi(
  rmp, win, buf, lnum, col, tm, timed_out);
--- 2890,2905 
  #ifdef FEAT_SYN_HL
reg_do_extmatch = 0;
  #endif
!   if (rmp->regprog == NULL)
{
+   // Somehow compiling the pattern failed now, put back the
+   // previous one to avoid "regprog" becoming NULL.
+   rmp->regprog = prev_prog;
+   }
+   else
+   {
+   vim_regfree(prev_prog);
+ 
rmp->regprog->re_in_use = TRUE;
result = rmp->regprog->engine->regexec_multi(
  rmp, win, buf, lnum, col, tm, timed_out);
*** ../vim-8.2.4686/src/version.c   2022-04-04 17:19:57.139569576 +0100
--- src/version.c   2022-04-04 17:52:15.376791260 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4687,
  /**/

-- 
The Law, in its majestic equality, forbids the rich, as well as the
poor, to sleep under the bridges, to beg in the streets, and to steal
bread.   -- Anatole France

 /// 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/20220404171511.1ADF31C0561%40moolenaar.net.


Patch 8.2.4686

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4686
Problem:Configure doesn't find the Motif library with Cygwin.
Solution:   Check for libXm.dll.a. (Kelvin Lee, closes #10077)
Files:  src/configure.ac, src/auto/configure


*** ../vim-8.2.4685/src/configure.ac2022-03-12 11:57:21.729327845 +
--- src/configure.ac2022-04-04 17:11:36.779298547 +0100
***
*** 2965,2975 
  
  dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere.  The
  dnl linker will figure out which one to use, we only check if one exists.
  AC_MSG_CHECKING(for location of Motif GUI libs)
  gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | 
sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo 
"$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
  GUI_LIB_LOC=
  for try in $gui_libs; do
!   for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl 
"$try"/libXm.dylib; do
if test -f "$libtry"; then
  GUI_LIB_LOC=$try
fi
--- 2965,2976 
  
  dnl Ubuntu has libXm.so in /usr/lib/i386-linux-gnu and elsewhere.  The
  dnl linker will figure out which one to use, we only check if one exists.
+ dnl Cygwin uses the .dll.a extension.
  AC_MSG_CHECKING(for location of Motif GUI libs)
  gui_libs="`echo $x_libraries|sed 's%/[^/][^/]*$%%'` `echo "$gui_XXX" | 
sed s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo 
"$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
  GUI_LIB_LOC=
  for try in $gui_libs; do
!   for libtry in "$try"/libXm.a "$try"/libXm.dll.a "$try"/libXm.so* 
"$try"/libXm.sl "$try"/libXm.dylib; do
if test -f "$libtry"; then
  GUI_LIB_LOC=$try
fi
*** ../vim-8.2.4685/src/auto/configure  2022-03-12 11:57:21.733327834 +
--- src/auto/configure  2022-04-04 17:13:34.183398352 +0100
***
*** 10212,10223 
  
  GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
  
! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of 
Motif GUI libs" >&5
  $as_echo_n "checking for location of Motif GUI libs... " >&6; }
  gui_libs="`echo $x_libraries|sed 's%/^/^/*$%%'` `echo "$gui_XXX" | sed 
s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo 
"$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
  GUI_LIB_LOC=
  for try in $gui_libs; do
!   for libtry in "$try"/libXm.a "$try"/libXm.so* "$try"/libXm.sl 
"$try"/libXm.dylib; do
if test -f "$libtry"; then
  GUI_LIB_LOC=$try
fi
--- 10212,10223 
  
  GUI_LIB_LOC="`echo $GUI_LIB_LOC|sed 's%-L%%g'`"
  
! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 
location of Motif GUI libs" >&5
  $as_echo_n "checking for location of Motif GUI libs... " >&6; }
  gui_libs="`echo $x_libraries|sed 's%/^/^/*$%%'` `echo "$gui_XXX" | sed 
s/XXX/lib/g` /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu `echo 
"$GUI_INC_LOC" | sed s/include/lib/` $GUI_LIB_LOC"
  GUI_LIB_LOC=
  for try in $gui_libs; do
!   for libtry in "$try"/libXm.a "$try"/libXm.dll.a "$try"/libXm.so* 
"$try"/libXm.sl "$try"/libXm.dylib; do
if test -f "$libtry"; then
  GUI_LIB_LOC=$try
fi
*** ../vim-8.2.4685/src/version.c   2022-04-04 16:56:50.776629692 +0100
--- src/version.c   2022-04-04 17:13:42.683404499 +0100
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4686,
  /**/

-- 
Men may not be seen publicly in any kind of strapless gown.
[real standing law in Florida, United States of America]

 /// 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/20220404162046.83B921C0561%40moolenaar.net.


Patch 8.2.4685

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4685
Problem:When a swap file is found for a popup there is no dialog and the
buffer is loaded anyway.
Solution:   Silently load the buffer read-only. (closes #10073)
Files:  runtime/doc/popup.txt, src/memline.c, src/popupwin.c, src/vim.h,
src/buffer.c, src/testdir/test_popupwin.vim


*** ../vim-8.2.4684/runtime/doc/popup.txt   2021-11-29 17:37:38.059265225 
+
--- runtime/doc/popup.txt   2022-04-04 16:42:17.060508340 +0100
***
*** 260,267 
Can also be used as a |method|: >
GetPopup()->popup_close()
  
  popup_create({what}, {options})   *popup_create()*
!   Open a popup window showing {what}, which is either:
- a buffer number
- a string
- a list of strings
--- 260,268 
Can also be used as a |method|: >
GetPopup()->popup_close()
  
+ 
  popup_create({what}, {options})   *popup_create()*
!   Open a popup window showing {what}, which is either: *E450*
- a buffer number
- a string
- a list of strings
***
*** 270,275 
--- 271,281 
'buftype' set to "popup".  That buffer will be wiped out once
the popup closes.
  
+   if {what} is a buffer number and loading the buffer runs into
+   an existing swap file, it is silently opened read-only, as if
+   a |SwapExists| autocommand had set |v:swapchoice| to 'o'.
+   This is because we assume the buffer is only used for viewing.
+ 
{options} is a dictionary with many possible entries.
See |popup_create-arguments| for details.
  
*** ../vim-8.2.4684/src/memline.c   2022-03-23 13:54:47.968796508 +
--- src/memline.c   2022-04-04 16:29:37.610753055 +0100
***
*** 4631,4649 
  --no_wait_return;
  }
  
  #if defined(FEAT_EVAL)
  /*
   * Trigger the SwapExists autocommands.
!  * Returns a value for equivalent to do_dialog() (see below):
!  * 0: still need to ask for a choice
!  * 1: open read-only
!  * 2: edit anyway
!  * 3: recover
!  * 4: delete it
!  * 5: quit
!  * 6: abort
   */
! static int
  do_swapexists(buf_T *buf, char_u *fname)
  {
  set_vim_var_string(VV_SWAPNAME, fname, -1);
--- 4631,4652 
  --no_wait_return;
  }
  
+ typedef enum {
+ SEA_CHOICE_NONE = 0,
+ SEA_CHOICE_READONLY = 1,
+ SEA_CHOICE_EDIT = 2,
+ SEA_CHOICE_RECOVER = 3,
+ SEA_CHOICE_DELETE = 4,
+ SEA_CHOICE_QUIT = 5,
+ SEA_CHOICE_ABORT = 6
+ } sea_choice_T;
+ 
  #if defined(FEAT_EVAL)
  /*
   * Trigger the SwapExists autocommands.
!  * Returns a value for equivalent to do_dialog().
   */
! static sea_choice_T
  do_swapexists(buf_T *buf, char_u *fname)
  {
  set_vim_var_string(VV_SWAPNAME, fname, -1);
***
*** 4659,4673 
  
  switch (*get_vim_var_str(VV_SWAPCHOICE))
  {
!   case 'o': return 1;
!   case 'e': return 2;
!   case 'r': return 3;
!   case 'd': return 4;
!   case 'q': return 5;
!   case 'a': return 6;
  }
  
! return 0;
  }
  #endif
  
--- 4662,4676 
  
  switch (*get_vim_var_str(VV_SWAPCHOICE))
  {
!   case 'o': return SEA_CHOICE_READONLY;
!   case 'e': return SEA_CHOICE_EDIT;
!   case 'r': return SEA_CHOICE_RECOVER;
!   case 'd': return SEA_CHOICE_DELETE;
!   case 'q': return SEA_CHOICE_QUIT;
!   case 'a': return SEA_CHOICE_ABORT;
  }
  
! return SEA_CHOICE_NONE;
  }
  #endif
  
***
*** 4986,4995 
if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED)
&& vim_strchr(p_shm, SHM_ATTENTION) == NULL)
{
!   int choice = 0;
!   stat_T  st;
  #ifdef CREATE_DUMMY_FILE
!   int did_use_dummy = FALSE;
  
// Avoid getting a warning for the file being created
// outside of Vim, it was created at the start of this
--- 4989,4998 
if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED)
&& vim_strchr(p_shm, SHM_ATTENTION) == NULL)
{
!   sea_choice_T choice = SEA_CHOICE_NONE;
!   stat_T   st;
  #ifdef CREATE_DUMMY_FILE
!   int  did_use_dummy = FALSE;
  
// Avoid getting a warning for the file being created
// outside of Vim, it was created at the start of this
***
*** 5013,5019 
if (mch_stat((char *)buf->b_fname, &st) == 0
  && swapfile_unchanged(fname))
{
!   choice = 4;
if (p_verbose > 0)

Patch 8.2.4684

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4684
Problem:Cannot open a channel on a Unix domain socket.
Solution:   Add Unix domain socket support. (closes #10062)
Files:  runtime/doc/channel.txt, src/channel.c, src/testdir/check.vim,
src/testdir/shared.vim, src/testdir/test_channel.py,
src/testdir/test_channel.vim, src/testdir/test_channel_unix.py,
src/testdir/test_cmdline.vim


*** ../vim-8.2.4683/runtime/doc/channel.txt 2022-03-30 10:14:41.485657271 
+0100
--- runtime/doc/channel.txt 2022-04-04 15:39:23.550236560 +0100
***
*** 119,128 
  
  Use |ch_status()| to see if the channel could be opened.
  
! {address} has the form "hostname:port".  E.g., "localhost:8765".
! 
! When using an IPv6 address, enclose it within square brackets.  E.g.,
! "[2001:db8::1]:8765".
  
  {options} is a dictionary with optional entries:  *channel-open-options*
  
--- 119,131 
  
  Use |ch_status()| to see if the channel could be opened.
  
!   *channel-address*
! {address} can be a domain name or an IP address, followed by a port number, or
! a Unix-domain socket path prefixed by "unix:".  E.g. >
! www.example.com:80   " domain + port
! 127.0.0.1:1234   " IPv4 + port
! [2001:db8::1]:8765   " IPv6 + port
! unix:/tmp/my-socket  " Unix-domain socket path
  
  {options} is a dictionary with optional entries:  *channel-open-options*
  
***
*** 579,588 
--- 582,596 
When opened with ch_open():
   "hostname" the hostname of the address
   "port" the port of the address
+  "path" the path of the Unix-domain socket
   "sock_status"  "open" or "closed"
   "sock_mode""NL", "RAW", "JSON" or "JS"
   "sock_io"  "socket"
   "sock_timeout" timeout in msec
+ 
+   Note that "pair" is only present for Unix-domain sockets, for
+   regular ones "hostname" and "port" are present instead.
+ 
When opened with job_start():
   "out_status"   "open", "buffered" or "closed"
   "out_mode" "NL", "RAW", "JSON" or "JS"
***
*** 641,651 
Open a channel to {address}.  See |channel|.
Returns a Channel.  Use |ch_status()| to check for failure.
  
!   {address} is a String and has the form "hostname:port", e.g.,
!   "localhost:8765".
! 
!   When using an IPv6 address, enclose it within square brackets.
!   E.g., "[2001:db8::1]:8765".
  
If {options} is given it must be a |Dictionary|.
See |channel-open-options|.
--- 649,656 
Open a channel to {address}.  See |channel|.
Returns a Channel.  Use |ch_status()| to check for failure.
  
!   {address} is a String, see |channel-address| for the possible
!   accepted forms.
  
If {options} is given it must be a |Dictionary|.
See |channel-open-options|.
*** ../vim-8.2.4683/src/channel.c   2022-04-04 15:16:50.738014123 +0100
--- src/channel.c   2022-04-04 15:44:12.318053555 +0100
***
*** 44,54 
--- 44,61 
  # define sock_write(sd, buf, len) send((SOCKET)sd, buf, len, 0)
  # define sock_read(sd, buf, len) recv((SOCKET)sd, buf, len, 0)
  # define sock_close(sd) closesocket((SOCKET)sd)
+ // Support for Unix-domain sockets was added in Windows SDK 17061.
+ # define UNIX_PATH_MAX 108
+ typedef struct sockaddr_un {
+ ADDRESS_FAMILY sun_family;
+ char sun_path[UNIX_PATH_MAX];
+ } SOCKADDR_UN, *PSOCKADDR_UN;
  #else
  # include 
  # include 
  # include 
  # include 
+ # include 
  # ifdef HAVE_LIBGEN_H
  #  include 
  # endif
***
*** 929,934 
--- 936,1002 
  }
  
  /*
+  * Open a socket channel to the UNIX socket at "path".
+  * Returns the channel for success.
+  * Returns NULL for failure.
+  */
+ static channel_T *
+ channel_open_unix(
+   const char *path,
+   void (*nb_close_cb)(void))
+ {
+ channel_T *channel = NULL;
+ int   sd = -1;
+ size_tpath_len = STRLEN(path);
+ struct sockaddr_unserver;
+ size_tserver_len;
+ int   waittime = -1;
+ 
+ if (*path == NUL || path_len >= sizeof(server.sun_path))
+ {
+   semsg(_(e_invalid_argument_str), path);
+   return NULL;
+ }
+ 
+ channel = add_channel();
+ if (channel == NULL)
+ {
+   ch_error(NULL, "Cannot allocate channel.");
+   return NULL;
+ }
+ 
+ CLEAR_FIELD(server);
+ server.sun_family = AF_UNIX;
+ STRNCPY(server.sun_path, path, sizeof(server.sun_path) - 1);
+ 
+ ch_log(channel, "Trying to connect to %s", path);
+ 
+ server_len = offsetof(struct sockaddr_un, sun_path) + path_len +

Test_terminal_tmap test failure in CI

2022-04-04 Fir de Conversatie Yegappan Lakshmanan
Hi,

The Test_terminal_tmap() test fails occasionally in the Linux GUI CI action:

https://github.com/vim/vim/runs/5817654101?check_suite_focus=true

I am not able to reproduce this failure in a local setup. I don't know where
it fails in that test. Is anyone else able to reproduce this failure?

Thanks,
Yegappan

-- 
-- 
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/CAAW7x7%3DXu_WA21HMcNO4vg_7zdjs%3DJmeR%3De7GwKJnTS%3DsiVJ1Q%40mail.gmail.com.


Patch 8.2.4683

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4683
Problem:Verbose check with dict_find() to see if a key is present.
Solution:   Add dict_has_key(). (Yegappan Lakshmanan, closes #10074)
Files:  src/channel.c, src/dict.c, src/evalwindow.c, src/filepath.c,
src/highlight.c, src/json.c, src/match.c, src/popupwin.c,
src/proto/dict.pro, src/quickfix.c, src/search.c, src/sign.c,
src/tag.c, src/terminal.c, src/testing.c, src/textprop.c,
src/time.c


*** ../vim-8.2.4682/src/channel.c   2022-03-30 10:14:41.485657271 +0100
--- src/channel.c   2022-04-04 15:14:05.061617592 +0100
***
*** 4460,4467 
}
  
if (argvars[2].v_type == VAR_DICT)
!   if (dict_find(argvars[2].vval.v_dict, (char_u *)"callback", -1)
!   != NULL)
callback_present = TRUE;
  
if (eval || callback_present)
--- 4460,4466 
}
  
if (argvars[2].v_type == VAR_DICT)
!   if (dict_has_key(argvars[2].vval.v_dict, "callback"))
callback_present = TRUE;
  
if (eval || callback_present)
***
*** 4482,4488 
if (di != NULL)
id = di->di_tv.vval.v_number;
}
!   if (dict_find(d, (char_u *)"jsonrpc", -1) == NULL)
dict_add_string(d, "jsonrpc", (char_u *)"2.0");
text = json_encode_lsp_msg(&argvars[1]);
  }
--- 4481,4487 
if (di != NULL)
id = di->di_tv.vval.v_number;
}
!   if (!dict_has_key(d, "jsonrpc"))
dict_add_string(d, "jsonrpc", (char_u *)"2.0");
text = json_encode_lsp_msg(&argvars[1]);
  }
*** ../vim-8.2.4682/src/dict.c  2022-02-05 14:05:48.128149067 +
--- src/dict.c  2022-04-04 15:14:05.061617592 +0100
***
*** 649,654 
--- 649,663 
  }
  
  /*
+  * Returns TRUE if "key" is present in Dictionary "d".
+  */
+ int
+ dict_has_key(dict_T *d, char *key)
+ {
+ return dict_find(d, (char_u *)key, -1) != NULL;
+ }
+ 
+ /*
   * Get a typval_T item from a dictionary and copy it into "rettv".
   * Returns FAIL if the entry doesn't exist or out of memory.
   */
***
*** 1582,1589 
  if (argvars[0].vval.v_dict == NULL)
return;
  
! rettv->vval.v_number = dict_find(argvars[0].vval.v_dict,
! tv_get_string(&argvars[1]), -1) != NULL;
  }
  
  #endif // defined(FEAT_EVAL)
--- 1591,1598 
  if (argvars[0].vval.v_dict == NULL)
return;
  
! rettv->vval.v_number = dict_has_key(argvars[0].vval.v_dict,
!   (char *)tv_get_string(&argvars[1]));
  }
  
  #endif // defined(FEAT_EVAL)
*** ../vim-8.2.4682/src/evalwindow.c2022-01-11 12:37:16.827153847 +
--- src/evalwindow.c2022-04-04 15:14:05.061617592 +0100
***
*** 1220,1246 
emsg(_(e_invalid_argument));
  else
  {
!   if (dict_find(dict, (char_u *)"lnum", -1) != NULL)
curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u 
*)"lnum");
!   if (dict_find(dict, (char_u *)"col", -1) != NULL)
curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u 
*)"col");
!   if (dict_find(dict, (char_u *)"coladd", -1) != NULL)
curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u 
*)"coladd");
!   if (dict_find(dict, (char_u *)"curswant", -1) != NULL)
{
curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u 
*)"curswant");
curwin->w_set_curswant = FALSE;
}
  
!   if (dict_find(dict, (char_u *)"topline", -1) != NULL)
set_topline(curwin, (linenr_T)dict_get_number(dict, (char_u 
*)"topline"));
  #ifdef FEAT_DIFF
!   if (dict_find(dict, (char_u *)"topfill", -1) != NULL)
curwin->w_topfill = (int)dict_get_number(dict, (char_u *)"topfill");
  #endif
!   if (dict_find(dict, (char_u *)"leftcol", -1) != NULL)
curwin->w_leftcol = (colnr_T)dict_get_number(dict, (char_u 
*)"leftcol");
!   if (dict_find(dict, (char_u *)"skipcol", -1) != NULL)
curwin->w_skipcol = (colnr_T)dict_get_number(dict, (char_u 
*)"skipcol");
  
check_cursor();
--- 1220,1246 
emsg(_(e_invalid_argument));
  else
  {
!   if (dict_has_key(dict, "lnum"))
curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u 
*)"lnum");
!   if (dict_has_key(dict, "col"))
curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u 
*)"col");
!   if (dict_has_key(dict, "coladd"))
curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u 
*)"coladd");
!   if (dict_has_key(dict, "curswant"))
{
curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u 
*)"curswant");
curwin->w_set_curswant = FALSE;
}
  
!   if (dict_has_key(dict, "topline"))
set_topline

Patch 8.2.4682

2022-04-04 Fir de Conversatie Bram Moolenaar


Patch 8.2.4682
Problem:Vim9: can use :unlockvar for const variable. (Ernie Rael)
Solution:   Check whether the variable is a const.
Files:  src/ex_docmd.c, src/evalvars.c, src/vim9script.c,
src/proto/vim9script.pro, src/eval.c, src/userfunc.c,
src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4681/src/ex_docmd.c  2022-03-31 11:37:54.259367941 +0100
--- src/ex_docmd.c  2022-04-04 13:51:14.849756816 +0100
***
*** 303,309 
  # define ex_throw ex_ni
  # define ex_try   ex_ni
  # define ex_unlet ex_ni
- # define ex_unlockvar ex_ni
  # define ex_while ex_ni
  # define ex_importex_ni
  # define ex_exportex_ni
--- 303,308 
*** ../vim-8.2.4681/src/evalvars.c  2022-04-01 15:26:54.984558728 +0100
--- src/evalvars.c  2022-04-04 14:27:57.000696536 +0100
***
*** 1951,1973 
  lp->ll_name);
ret = FAIL;
}
-   else if ((di->di_flags & DI_FLAGS_FIX)
-   && di->di_tv.v_type != VAR_DICT
-   && di->di_tv.v_type != VAR_LIST)
-   {
-   // For historic reasons this error is not given for a list or
-   // dict.  E.g., the b: dict could be locked/unlocked.
-   semsg(_(e_cannot_lock_or_unlock_variable_str), lp->ll_name);
-   ret = FAIL;
-   }
else
{
!   if (lock)
!   di->di_flags |= DI_FLAGS_LOCK;
else
!   di->di_flags &= ~DI_FLAGS_LOCK;
!   if (deep != 0)
!   item_lock(&di->di_tv, deep, lock, FALSE);
}
}
*name_end = cc;
--- 1951,1992 
  lp->ll_name);
ret = FAIL;
}
else
{
!   if ((di->di_flags & DI_FLAGS_FIX)
!   && di->di_tv.v_type != VAR_DICT
!   && di->di_tv.v_type != VAR_LIST)
!   {
!   // For historic reasons this error is not given for a list
!   // or dict.  E.g., the b: dict could be locked/unlocked.
!   semsg(_(e_cannot_lock_or_unlock_variable_str), lp->ll_name);
!   ret = FAIL;
!   }
else
!   {
!   if (in_vim9script())
!   {
!   svar_T  *sv = find_typval_in_script(&di->di_tv,
!0, FALSE);
! 
!   if (sv != NULL && sv->sv_const != 0)
!   {
!   semsg(_(e_cannot_change_readonly_variable_str),
! lp->ll_name);
!   ret = FAIL;
!   }
!   }
! 
!   if (ret == OK)
!   {
!   if (lock)
!   di->di_flags |= DI_FLAGS_LOCK;
!   else
!   di->di_flags &= ~DI_FLAGS_LOCK;
!   if (deep != 0)
!   item_lock(&di->di_tv, deep, lock, FALSE);
!   }
!   }
}
}
*name_end = cc;
***
*** 2812,2818 
if (ht != NULL && ht == get_script_local_ht()
&& tv != &SCRIPT_SV(current_sctx.sc_sid)->sv_var.di_tv)
{
!   svar_T *sv = find_typval_in_script(tv, 0);
  
if (sv != NULL)
type = sv->sv_type;
--- 2831,2837 
if (ht != NULL && ht == get_script_local_ht()
&& tv != &SCRIPT_SV(current_sctx.sc_sid)->sv_var.di_tv)
{
!   svar_T *sv = find_typval_in_script(tv, 0, TRUE);
  
if (sv != NULL)
type = sv->sv_type;
***
*** 3557,3563 
if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0)
{
where_T where = WHERE_INIT;
!   svar_T  *sv = find_typval_in_script(&di->di_tv, sid);
  
if (sv != NULL)
{
--- 3576,3582 
if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0)
{
where_T where = WHERE_INIT;
!   svar_T  *sv = find_typval_in_script(&di->di_tv, sid, TRUE);
  
if (sv != NULL)
{
*** ../vim-8.2.4681/src/vim9script.c2022-03-31 16:18:19.916278625 +0100
--- src/vim9script.c2022-04-04 14:28:35.032682564 +0100
***
*** 956,962 
  }
  else
  {
!   sv = find_typval_in_script(&di->di_tv, 0);
  }
  if (sv != NULL)
  {
--- 956,962 

Re: vim9script const questions and datastructures

2022-04-04 Fir de Conversatie Bram Moolenaar


Ernie Rael wrote:

> This doesn't produce an error. Should it?
> 
> const c1 = 3
> unlockvar c1
> 
> Of course, there is an error on an attempt to modify c1.

It's better to give an error when trying to unlock.  I'll make a patch
for that.

> I was wondering about const optimizations; figured now's not the time to 
> mention it. Then saw that "len('string')" would be done at compile time. 
> So here goes.
> 
> Is a list a cheap kind of a "C" struct. Define the struct like
> 
> const field1 = 0
> const field2 = 1
> const field3 = 2
> 
> and use these consts as list indexes. The struct is adjusted by changing 
> the const's.

That works, but there currently is no optimization for using a const
variable in a compiled function, like there is for a number.  Maybe this
can be implemented later.  You can see what happens using the
:disassemble command.

> Using a dict gives the cleanest looking code, and I'd guess the worst 
> performance.

Dictionary access has a bit of overhead, since a hash is computed to
look up items.  But the implementation has been tweaked to be fast (it's
very similar to how Python does this, and they have spent time on
optimizing the dictionary implementation).  In the end you can only know
by trying and measuring the performance.

> Since I haven't looked at the vim9 VM, it may be that PUSHNR/LISTINDEX 
> and LOADSCRIPT/LISTINDEX and MEMBER-'foo'/USEDICT are comparable (not 
> talking tight loop) and it's purely psychological and I shouldn't use 
> disassemble. But the constant value is typically available at compile 
> time for LISTINDEX.

A rough estimation is that every "simple" instruction takes some amount
of time.  If something can be done at compile time and it's executed
often, then it does get a lot faster.

> Something major I can't answer: are lists arrays or linked? That can 
> change the balance towards dict.

Yes :-).  Lists are linked, but sequential access can be fast.  Again,
you should try it out and measure perfornamce.  Moderns CPUs can execute
instructions very fast and caching often kicks in, making performance
largely unpredictable.

-- 
There is no right or wrong, there is only your personal opinion.
 (Bram Moolenaar)

 /// 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/20220404130900.A37BA1C05DA%40moolenaar.net.