Patch 8.2.3678

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3678 (after 8.2.3677)
Problem:Illegal memory access.
Solution:   Ignore changed indent when computing byte offset.
Files:  src/register.c


*** ../vim-8.2.3677/src/register.c  2021-11-25 19:31:11.415905063 +
--- src/register.c  2021-11-25 20:37:31.651563438 +
***
*** 2099,2104 
--- 2099,2105 
else
{
linenr_Tnew_lnum = new_cursor.lnum;
+   size_t  len;
  
// Insert at least one line.  When y_type is MCHAR, break the first
// line in two.
***
*** 2211,2221 
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
!   col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff;
if (col > 1)
curbuf->b_op_end.col = col - 1
- mb_head_off(y_array[y_size - 1],
!   y_array[y_size - 1] + col - 1);
else
curbuf->b_op_end.col = 0;
  
--- 2212,2223 
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
!   len = STRLEN(y_array[y_size - 1]);
!   col = (colnr_T)len - lendiff;
if (col > 1)
curbuf->b_op_end.col = col - 1
- mb_head_off(y_array[y_size - 1],
!   y_array[y_size - 1] + len - 1);
else
curbuf->b_op_end.col = 0;
  
*** ../vim-8.2.3677/src/version.c   2021-11-25 19:31:11.419905059 +
--- src/version.c   2021-11-25 20:38:21.843511468 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3678,
  /**/

-- 
Behold the warranty!  The bold print giveth and the fine print taketh.

 /// 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/20211125204040.6444F1C0A05%40moolenaar.net.


Patch 8.2.3677

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3677
Problem:After a put the '] mark is on the last byte of a multi-byte
character.
Solution:   Move it to the first byte. (closes #9047)
Files:  src/register.c, src/testdir/test_put.vim


*** ../vim-8.2.3676/src/register.c  2021-11-17 15:51:46.421992164 +
--- src/register.c  2021-11-25 19:30:11.855988039 +
***
*** 2004,2009 
--- 2004,2010 
{
linenr_Tend_lnum = 0; // init for gcc
linenr_Tstart_lnum = lnum;
+   int first_byte_off = 0;
  
if (VIsual_active)
{
***
*** 2065,2070 
--- 2066,2075 
}
STRMOVE(ptr, oldp + col);
ml_replace(lnum, newp, FALSE);
+ 
+   // compute the byte offset for the last character
+   first_byte_off = mb_head_off(newp, ptr - 1);
+ 
// Place cursor on last putted char.
if (lnum == curwin->w_cursor.lnum)
{
***
*** 2080,2089 
--- 2085,2099 
lnum--;
}
  
+   // put '] at the first byte of the last character
curbuf->b_op_end = curwin->w_cursor;
+   curbuf->b_op_end.col -= first_byte_off;
+ 
// For "CTRL-O p" in Insert mode, put cursor after last char
if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND)))
++curwin->w_cursor.col;
+   else
+   curwin->w_cursor.col -= first_byte_off;
changed_bytes(lnum, col);
}
else
***
*** 2198,2209 
changed_lines(curbuf->b_op_start.lnum, 0,
   curbuf->b_op_start.lnum, nr_lines);
  
!   // put '] mark at last inserted character
curbuf->b_op_end.lnum = new_lnum;
-   // correct length for change in indent
col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff;
if (col > 1)
!   curbuf->b_op_end.col = col - 1;
else
curbuf->b_op_end.col = 0;
  
--- 2208,2221 
changed_lines(curbuf->b_op_start.lnum, 0,
   curbuf->b_op_start.lnum, nr_lines);
  
!   // Put the '] mark on the first byte of the last inserted character.
!   // Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
col = (colnr_T)STRLEN(y_array[y_size - 1]) - lendiff;
if (col > 1)
!   curbuf->b_op_end.col = col - 1
!   - mb_head_off(y_array[y_size - 1],
!   y_array[y_size - 1] + col - 1);
else
curbuf->b_op_end.col = 0;
  
*** ../vim-8.2.3676/src/testdir/test_put.vim2021-11-24 14:59:12.573593141 
+
--- src/testdir/test_put.vim2021-11-25 19:26:54.468265979 +
***
*** 197,201 
--- 197,214 
bwipe!
  endfunc
  
+ func Test_multibyte_op_end_mark()
+   new
+   call setline(1, 'тест')
+   normal viwdp
+   call assert_equal([0, 1, 7, 0], getpos("'>"))
+   call assert_equal([0, 1, 7, 0], getpos("']"))
+ 
+   normal Vyp
+   call assert_equal([0, 1, 2147483647, 0], getpos("'>"))
+   call assert_equal([0, 2, 7, 0], getpos("']"))
+   bwipe!
+ endfunc
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3676/src/version.c   2021-11-25 15:10:45.388754445 +
--- src/version.c   2021-11-25 18:52:44.599374597 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3677,
  /**/

-- 
A law to reduce crime states: "It is mandatory for a motorist with criminal
intentions to stop at the city limits and telephone the chief of police as he
is entering the town.
[real standing law in Washington, 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/20211125193142.D8B151C0A05%40moolenaar.net.


Re: syntax/vim.vim - support python << trim

2021-11-25 Fir de Conversatie Charles Campbell

Ben Jackson wrote:

Thanks, Bram, will do.

I just looked over your patch. Why is it necessary? syntax/vim.vim, 
without it, already handles


py3 

Patch 8.2.3676

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3676
Problem:Unused runtime file.
Solution:   Remove rgb.txt.
Files:  runtime/rgb.txt


*** ../vim-8.2.3675/runtime/rgb.txt 2016-07-19 19:44:13.0 +0100
--- runtime/rgb.txt 1970-01-01 00:00:00.0 +
***
*** 1,782 
- 255 250 250   snow
- 248 248 255   ghost white
- 248 248 255   GhostWhite
- 245 245 245   white smoke
- 245 245 245   WhiteSmoke
- 220 220 220   gainsboro
- 255 250 240   floral white
- 255 250 240   FloralWhite
- 253 245 230   old lace
- 253 245 230   OldLace
- 250 240 230   linen
- 250 235 215   antique white
- 250 235 215   AntiqueWhite
- 255 239 213   papaya whip
- 255 239 213   PapayaWhip
- 255 235 205   blanched almond
- 255 235 205   BlanchedAlmond
- 255 228 196   bisque
- 255 218 185   peach puff
- 255 218 185   PeachPuff
- 255 222 173   navajo white
- 255 222 173   NavajoWhite
- 255 228 181   moccasin
- 255 248 220   cornsilk
- 255 255 240   ivory
- 255 250 205   lemon chiffon
- 255 250 205   LemonChiffon
- 255 245 238   seashell
- 240 255 240   honeydew
- 245 255 250   mint cream
- 245 255 250   MintCream
- 240 255 255   azure
- 240 248 255   alice blue
- 240 248 255   AliceBlue
- 230 230 250   lavender
- 255 240 245   lavender blush
- 255 240 245   LavenderBlush
- 255 228 225   misty rose
- 255 228 225   MistyRose
- 255 255 255   white
-   0   0   0   black
-  47  79  79   dark slate gray
-  47  79  79   DarkSlateGray
-  47  79  79   dark slate grey
-  47  79  79   DarkSlateGrey
- 105 105 105   dim gray
- 105 105 105   DimGray
- 105 105 105   dim grey
- 105 105 105   DimGrey
- 112 128 144   slate gray
- 112 128 144   SlateGray
- 112 128 144   slate grey
- 112 128 144   SlateGrey
- 119 136 153   light slate gray
- 119 136 153   LightSlateGray
- 119 136 153   light slate grey
- 119 136 153   LightSlateGrey
- 190 190 190   gray
- 190 190 190   grey
- 190 190 190   x11 gray
- 190 190 190   X11Gray
- 190 190 190   x11 grey
- 190 190 190   X11Grey
- 128 128 128   web gray
- 128 128 128   WebGray
- 128 128 128   web grey
- 128 128 128   WebGrey
- 211 211 211   light grey
- 211 211 211   LightGrey
- 211 211 211   light gray
- 211 211 211   LightGray
-  25  25 112   midnight blue
-  25  25 112   MidnightBlue
-   0   0 128   navy
-   0   0 128   navy blue
-   0   0 128   NavyBlue
- 100 149 237   cornflower blue
- 100 149 237   CornflowerBlue
-  72  61 139   dark slate blue
-  72  61 139   DarkSlateBlue
- 106  90 205   slate blue
- 106  90 205   SlateBlue
- 123 104 238   medium slate blue
- 123 104 238   MediumSlateBlue
- 132 112 255   light slate blue
- 132 112 255   LightSlateBlue
-   0   0 205   medium blue
-   0   0 205   MediumBlue
-  65 105 225   royal blue
-  65 105 225   RoyalBlue
-   0   0 255   blue
-  30 144 255   dodger blue
-  30 144 255   DodgerBlue
-   0 191 255   deep sky blue
-   0 191 255   DeepSkyBlue
- 135 206 235   sky blue
- 135 206 235   SkyBlue
- 135 206 250   light sky blue
- 135 206 250   LightSkyBlue
-  70 130 180   steel blue
-  70 130 180   SteelBlue
- 176 196 222   light steel blue
- 176 196 222   LightSteelBlue
- 173 216 230   light blue
- 173 216 230   LightBlue
- 176 224 230   powder blue
- 176 224 230   PowderBlue
- 175 238 238   pale turquoise
- 175 238 238   PaleTurquoise
-   0 206 209   dark turquoise
-   0 206 209   DarkTurquoise
-  72 209 204   medium turquoise
-  72 209 204   MediumTurquoise
-  64 224 208   turquoise
-   0 255 255   cyan
-   0 255 255   aqua
- 224 255 255   light cyan
- 224 255 255   LightCyan
-  95 158 160   cadet blue
-  95 158 160   CadetBlue
- 102 205 170   medium aquamarine
- 102 205 170   MediumAquamarine
- 127 255 212   aquamarine
-   0 100   0   dark green
-   0 100   0   DarkGreen
-  85 107  47   dark olive green
-  85 107  47   DarkOliveGreen
- 143 188 143   dark sea green
- 143 188 143   DarkSeaGreen
-  46 139  87   sea green
-  46 139  87   SeaGreen
-  60 179 113   medium sea green
-  60 179 113   MediumSeaGreen
-  32 178 1

Patch 8.2.3675

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3675
Problem:Using freed memory when vim_strsave() fails.
Solution:   Clear "last_sourcing_name".  Check for msg_source() called
recursively. (closes #8217)
Files:  src/message.c


*** ../vim-8.2.3674/src/message.c   2021-11-25 13:39:22.591524947 +
--- src/message.c   2021-11-25 14:41:49.958792792 +
***
*** 522,527 
--- 522,533 
  msg_source(int attr)
  {
  char_u*p;
+ static intrecursive = FALSE;
+ 
+ // Bail out if something called here causes an error.
+ if (recursive)
+   return;
+ recursive = TRUE;
  
  ++no_wait_return;
  p = get_emsg_source();
***
*** 541,553 
  // remember the last sourcing name printed, also when it's empty
  if (SOURCING_NAME == NULL || other_sourcing_name())
  {
!   vim_free(last_sourcing_name);
!   if (SOURCING_NAME == NULL)
!   last_sourcing_name = NULL;
!   else
last_sourcing_name = vim_strsave(SOURCING_NAME);
  }
  --no_wait_return;
  }
  
  /*
--- 547,559 
  // remember the last sourcing name printed, also when it's empty
  if (SOURCING_NAME == NULL || other_sourcing_name())
  {
!   VIM_CLEAR(last_sourcing_name);
!   if (SOURCING_NAME != NULL)
last_sourcing_name = vim_strsave(SOURCING_NAME);
  }
  --no_wait_return;
+ 
+ recursive = FALSE;
  }
  
  /*
*** ../vim-8.2.3674/src/version.c   2021-11-25 13:52:33.215676364 +
--- src/version.c   2021-11-25 14:42:50.786714484 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3675,
  /**/

-- 
 Girls are like internet domain names,
the ones I like are already taken.
  Well, you can stil get one from a strange country :-P

 /// 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/20211125144346.E53411C0A05%40moolenaar.net.


Patch 8.2.3674

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3674
Problem:When ml_get_buf() fails it messes up IObuff.
Solution:   Return a local pointer. (closes #9214)
Files:  src/memline.c


*** ../vim-8.2.3673/src/memline.c   2021-10-19 22:12:21.936582330 +0100
--- src/memline.c   2021-11-25 13:52:07.223678254 +
***
*** 2606,2611 
--- 2606,2612 
  bhdr_T*hp;
  DATA_BL   *dp;
  static intrecursive = 0;
+ static char_u questions[4];
  
  if (lnum > buf->b_ml.ml_line_count)   // invalid line number
  {
***
*** 2618,2626 
--recursive;
}
  errorret:
!   STRCPY(IObuff, "???");
buf->b_ml.ml_line_len = 4;
!   return IObuff;
  }
  if (lnum <= 0)// pretend line 0 is line 1
lnum = 1;
--- 2619,2627 
--recursive;
}
  errorret:
!   STRCPY(questions, "???");
buf->b_ml.ml_line_len = 4;
!   return questions;
  }
  if (lnum <= 0)// pretend line 0 is line 1
lnum = 1;
*** ../vim-8.2.3673/src/version.c   2021-11-25 13:39:22.595524952 +
--- src/version.c   2021-11-25 13:52:18.387677464 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3674,
  /**/

-- 
Lawmakers made it obligatory for everybody to take at least one bath
each week -- on Saturday night.
[real standing law in Vermont, 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/20211125135311.3C3431C0A05%40moolenaar.net.


Patch 8.2.3673

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3673
Problem:Crash when allocating signal stack fails.
Solution:   Only using sourcing info when available. (closes #9215)
Files:  src/globals.h, src/message.c


*** ../vim-8.2.3672/src/globals.h   2021-11-18 18:52:08.820648765 +
--- src/globals.h   2021-11-25 13:36:48.203403125 +
***
*** 288,293 
--- 288,294 
   * Current context is at ga_len - 1.
   */
  EXTERN garray_T   exestack INIT5(0, 0, sizeof(estack_T), 50, NULL);
+ #define HAVE_SOURCING_INFO  (exestack.ga_data != NULL && exestack.ga_len > 0)
  // name of error message source
  #define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 
1].es_name)
  // line number in the message source or zero
*** ../vim-8.2.3672/src/message.c   2021-09-10 15:58:24.446743066 +0100
--- src/message.c   2021-11-25 13:37:11.351424648 +
***
*** 446,452 
  static int
  other_sourcing_name(void)
  {
! if (SOURCING_NAME != NULL)
  {
if (last_sourcing_name != NULL)
return STRCMP(SOURCING_NAME, last_sourcing_name) != 0;
--- 446,452 
  static int
  other_sourcing_name(void)
  {
! if (HAVE_SOURCING_INFO && SOURCING_NAME != NULL)
  {
if (last_sourcing_name != NULL)
return STRCMP(SOURCING_NAME, last_sourcing_name) != 0;
***
*** 465,471 
  {
  char_u*Buf, *p;
  
! if (SOURCING_NAME != NULL && other_sourcing_name())
  {
char_u  *sname = estack_sfile(ESTACK_NONE);
char_u  *tofree = sname;
--- 465,471 
  {
  char_u*Buf, *p;
  
! if (HAVE_SOURCING_INFO && SOURCING_NAME != NULL && other_sourcing_name())
  {
char_u  *sname = estack_sfile(ESTACK_NONE);
char_u  *tofree = sname;
*** ../vim-8.2.3672/src/version.c   2021-11-25 13:26:16.034041048 +
--- src/version.c   2021-11-25 13:38:45.511500090 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3673,
  /**/

-- 
"Software is like sex... it's better when it's free."
-- Linus Torvalds, initiator of the free Linux OS
Makes me wonder what FSF stands for...?

 /// 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/20211125134005.CAF441C0A05%40moolenaar.net.


Patch 8.2.3672

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3672 (after 8.2.3670)
Problem:Build failure with unsigned char.
Solution:   Use int instead of char.
Files:  src/xxd/xxd.c


*** ../vim-8.2.3671/src/xxd/xxd.c   2021-11-25 11:16:43.141318500 +
--- src/xxd/xxd.c   2021-11-25 13:24:29.597569997 +
***
*** 253,266 
  }
  
static void
! exit_on_ferror(char c, FILE *fpi)
  {
if (c == EOF && ferror(fpi))
  perror_exit(2);
  }
  
static void
! putc_or_die(char c, FILE *fpo)
  {
if (putc(c, fpo) == EOF)
  perror_exit(3);
--- 253,266 
  }
  
static void
! exit_on_ferror(int c, FILE *fpi)
  {
if (c == EOF && ferror(fpi))
  perror_exit(2);
  }
  
static void
! putc_or_die(int c, FILE *fpo)
  {
if (putc(c, fpo) == EOF)
  perror_exit(3);
*** ../vim-8.2.3671/src/version.c   2021-11-25 13:04:44.618340595 +
--- src/version.c   2021-11-25 13:25:45.853917893 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3672,
  /**/

-- 
It is illegal to take more than three sips of beer at a time while standing.
[real standing law in Texas, 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/20211125132701.5E9E41C0A05%40moolenaar.net.


Patch 8.2.3671

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3671
Problem:Restarting Insert mode in prompt buffer too often when a callback
switches windows and comes back. (Sean Dewar)
Solution:   Do not set "restart_edit" when already in Insert mode.
Files:  src/window.c, src/testdir/test_prompt_buffer.vim


*** ../vim-8.2.3670/src/window.c2021-11-20 13:45:37.810729599 +
--- src/window.c2021-11-25 13:03:47.430481302 +
***
*** 2268,2275 
stop_insert_mode = FALSE;
  
  // When entering the prompt window restart Insert mode if we were in 
Insert
! // mode when we left it.
! restart_edit = win->w_buffer->b_prompt_insert;
  }
  #endif
  
--- 2268,2276 
stop_insert_mode = FALSE;
  
  // When entering the prompt window restart Insert mode if we were in 
Insert
! // mode when we left it and not already in Insert mode.
! if ((State & INSERT) == 0)
!   restart_edit = win->w_buffer->b_prompt_insert;
  }
  #endif
  
*** ../vim-8.2.3670/src/testdir/test_prompt_buffer.vim  2021-06-10 
20:52:11.813718366 +0100
--- src/testdir/test_prompt_buffer.vim  2021-11-25 12:52:47.600676708 +
***
*** 39,44 
--- 39,48 
\ '  set nomodified',
\ 'endfunc',
\ '',
+   \ 'func SwitchWindows()',
+   \ '  call timer_start(0, {-> execute("wincmd p|wincmd p", "")})',
+   \ 'endfunc',
+   \ '',
\ 'call setline(1, "other buffer")',
\ 'set nomodified',
\ 'new',
***
*** 97,102 
--- 101,127 
  
call StopVimInTerminal(buf)
call delete(scriptName)
+ endfunc
+ 
+ func Test_prompt_switch_windows()
+   call CanTestPromptBuffer()
+   let scriptName = 'XpromptSwitchWindows'
+   call WriteScript(scriptName)
+ 
+   let buf = RunVimInTerminal('-S ' . scriptName, {'rows': 12})
+   call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
+   call WaitForAssert({-> assert_match('-- INSERT --', term_getline(buf, 12))})
+ 
+   call term_sendkeys(buf, "\:call SwitchWindows()\")
+   call term_wait(buf, 50)
+   call WaitForAssert({-> assert_match('-- INSERT --', term_getline(buf, 12))})
+ 
+   call term_sendkeys(buf, "\")
+   call term_wait(buf, 50)
+   call WaitForAssert({-> assert_match('^ *$', term_getline(buf, 12))})
+ 
+   call StopVimInTerminal(buf)
+   call delete(scriptName)
  endfunc
  
  func Test_prompt_garbage_collect()
*** ../vim-8.2.3670/src/version.c   2021-11-25 11:16:43.141318500 +
--- src/version.c   2021-11-25 11:41:28.790704089 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3671,
  /**/

-- 
No man may purchase alcohol without written consent from his wife.
[real standing law in Pennsylvania, 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/20211125130534.E5E161C0A05%40moolenaar.net.


Patch 8.2.3670

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3670
Problem:Error checks repeated several times.
Solution:   Move the checks to functions. (closes #9213)
Files:  src/xxd/xxd.c


*** ../vim-8.2.3669/src/xxd/xxd.c   2021-11-24 11:18:03.742223158 +
--- src/xxd/xxd.c   2021-11-25 11:14:33.161485429 +
***
*** 252,257 
--- 252,294 
exit(ret);
  }
  
+   static void
+ exit_on_ferror(char c, FILE *fpi)
+ {
+   if (c == EOF && ferror(fpi))
+ perror_exit(2);
+ }
+ 
+   static void
+ putc_or_die(char c, FILE *fpo)
+ {
+   if (putc(c, fpo) == EOF)
+ perror_exit(3);
+ }
+ 
+   static void
+ fputs_or_die(char *s, FILE *fpo)
+ {
+   if (fputs(s, fpo) == EOF)
+ perror_exit(3);
+ }
+ 
+   static void
+ fprintf_or_die(FILE *fpo, char *format, char *s, int d)
+ {
+   if (fprintf(fpo, format, s, d) < 0)
+ perror_exit(3);
+ }
+ 
+   static void
+ fclose_or_die(FILE *fpi, FILE *fpo)
+ {
+   if (fclose(fpo) != 0)
+ perror_exit(3);
+   if (fclose(fpi) != 0)
+ perror_exit(2);
+ }
+ 
  /*
   * If "c" is a hex digit, return the value.
   * Otherwise return -1.
***
*** 275,282 
  {
while (c != '\n' && c != EOF)
  c = getc(fpi);
!   if (c == EOF && ferror(fpi))
! perror_exit(2);
return c;
  }
  
--- 312,318 
  {
while (c != '\n' && c != EOF)
  c = getc(fpi);
!   exit_on_ferror(c, fpi);
return c;
  }
  
***
*** 342,355 
  if (base_off + want_off < have_off)
error_exit(5, "sorry, cannot seek backwards.");
  for (; have_off < base_off + want_off; have_off++)
!   if (putc(0, fpo) == EOF)
! perror_exit(3);
}
  
if (n2 >= 0 && n1 >= 0)
{
! if (putc((n2 << 4) | n1, fpo) == EOF)
!   perror_exit(3);
  have_off++;
  want_off++;
  n1 = -1;
--- 378,389 
  if (base_off + want_off < have_off)
error_exit(5, "sorry, cannot seek backwards.");
  for (; have_off < base_off + want_off; have_off++)
!   putc_or_die(0, fpo);
}
  
if (n2 >= 0 && n1 >= 0)
{
! putc_or_die((n2 << 4) | n1, fpo);
  have_off++;
  want_off++;
  n1 = -1;
***
*** 374,383 
  #ifdef TRY_SEEK
fseek(fpo, 0L, SEEK_END);
  #endif
!   if (fclose(fpo) != 0)
! perror_exit(3);
!   if (fclose(fpi) != 0)
! perror_exit(2);
return 0;
  }
  
--- 408,414 
  #ifdef TRY_SEEK
fseek(fpo, 0L, SEEK_END);
  #endif
!   fclose_or_die(fpi, fpo);
return 0;
  }
  
***
*** 409,423 
  if (nz < 0)
zero_seen--;
  if (zero_seen == 2)
!   if (fputs(z, fp) == EOF)
! perror_exit(3);
  if (zero_seen > 2)
!   if (fputs("*\n", fp) == EOF)
! perror_exit(3);
}
if (nz >= 0 || zero_seen > 0)
!   if (fputs(l, fp) == EOF)
! perror_exit(3);
if (nz)
zero_seen = 0;
  }
--- 440,451 
  if (nz < 0)
zero_seen--;
  if (zero_seen == 2)
!   fputs_or_die(z, fp);
  if (zero_seen > 2)
!   fputs_or_die("*\n", fp);
}
if (nz >= 0 || zero_seen > 0)
!   fputs_or_die(l, fp);
if (nz)
zero_seen = 0;
  }
***
*** 708,723 
  long s = seekoff;
  
  while (s--)
!   if (getc(fp) == EOF)
{
! if (ferror(fp))
!   {
! perror_exit(2);
!   }
! else
!   {
! error_exit(4, "sorry cannot seek.");
!   }
}
}
  }
--- 736,745 
  long s = seekoff;
  
  while (s--)
!   if ((c = getc(fp)) == EOF)
{
! exit_on_ferror(c, fp);
! error_exit(4, "sorry cannot seek.");
}
}
  }
***
*** 726,772 
  {
if (fp != stdin)
{
! if (fprintf(fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" 
: "") < 0)
!   perror_exit(3);
  for (e = 0; (c = argv[1][e]) != 0; e++)
!   if (putc(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo) == EOF)
! perror_exit(3);
! if (fputs("[] = {\n", fpo) == EOF)
!   perror_exit(3);
}
  
p = 0;
c = 0;
while ((length < 0 || p < length) && (c = getc(fp)) != EOF)
{
! if (fprintf(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
!   (p % cols) ? ", " : &",\n  "[2*!p],  c) < 0)
!   perror_exit(3);
  p++;
}
!   if (c == EOF && ferror(fp))
!   perror_exit(2);
  
!   if (p && fputs("\n", fpo) == EOF)
!   perror_exit(3);
!   if (fputs(&"};\n"[3 * (fp == stdin)], fpo) == EOF)
!   perror_exit(3);
  
if (fp != stdin)
{
! if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : 
"") < 0)
!

Re: syntax/vim.vim - support python << trim

2021-11-25 Fir de Conversatie Ben Jackson
Thanks, Bram, will do.

> On 25 Nov 2021, at 10:51, Bram Moolenaar  wrote:
> 
> 
> Ben Jackson wrote:
> 
>> I proposed this patch a while back to Charles, but I don’t think I got a
>> response.
>> It adds support for "py3 << trim EOF” in vim.vim syntax file.
>> I can make a GitHub PR if you prefer.
> 
> You could make a PR and ping @cecamp
> Charles is around but does not spend much time on Vim.
> 
> -- 
> 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 -- 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/9D2A0995-5116-4579-B67F-0FBF3D3577EE%40gmail.com.


Re: Fwd: syntax/vim.vim - support python << trim

2021-11-25 Fir de Conversatie Bram Moolenaar


Ben Jackson wrote:

> I proposed this patch a while back to Charles, but I don’t think I got a
> response.
> It adds support for "py3 << trim EOF” in vim.vim syntax file.
> I can make a GitHub PR if you prefer.

You could make a PR and ping @cecamp
Charles is around but does not spend much time on Vim.

-- 
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 -- 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/20211125105130.A748C1C0A05%40moolenaar.net.


Patch 8.2.3669

2021-11-25 Fir de Conversatie Bram Moolenaar


Patch 8.2.3669
Problem:Buffer overflow with long help argument.
Solution:   Use snprintf().
Files:  src/help.c, src/testdir/test_help.vim


*** ../vim-8.2.3668/src/help.c  2021-06-02 12:28:11.431120460 +0100
--- src/help.c  2021-11-25 10:49:17.146843905 +
***
*** 422,429 
|| (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
   && arg[2] != NUL)))
{
!   STRCPY(d, "/");
!   STRCPY(d + 3, arg + 1);
// Check for "/\\_$", should be "/\\_\$"
if (d[3] == '_' && d[4] == '$')
STRCPY(d + 4, "\\$");
--- 422,428 
|| (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
   && arg[2] != NUL)))
{
!   vim_snprintf((char *)d, IOSIZE, "/%s", arg + 1);
// Check for "/\\_$", should be "/\\_\$"
if (d[3] == '_' && d[4] == '$')
STRCPY(d + 4, "\\$");
*** ../vim-8.2.3668/src/testdir/test_help.vim   2021-06-12 12:46:38.055854976 
+0100
--- src/testdir/test_help.vim   2021-11-25 10:48:57.138842071 +
***
*** 134,137 
--- 134,146 
close
  endfunc
  
+ func Test_help_long_argument()
+   try
+ exe 'help \%' .. repeat('0', 1021)
+   catch
+ call assert_match("E149:", v:exception)
+   endtry
+ endfunc
+ 
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3668/src/version.c   2021-11-24 20:28:23.599595260 +
--- src/version.c   2021-11-25 10:42:07.630521494 +
***
*** 759,760 
--- 759,762 
  {   /* Add new patch number below this line */
+ /**/
+ 3669,
  /**/

-- 
Dogs must have a permit signed by the mayor in order to congregate in groups
of three or more on private property.
[real standing law in Oklahoma, 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/20211125105130.A96AA1C0873%40moolenaar.net.


Fwd: syntax/vim.vim - support python << trim

2021-11-25 Fir de Conversatie Ben Jackson
Hi Bram,I proposed this patch a while back to Charles, but I don’t think I got a response.It adds support for "py3 << trim EOF” in vim.vim syntax file.I can make a GitHub PR if you prefer.TaBenBegin forwarded message:From: Ben Jackson Subject: Re: syntax/vim.vim - support python << trimDate: 3 April 2021 at 15:22:05 BSTTo: Charles Campbell Attached correct patch. Sorry for the spam...



-- 
-- 
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/B85B3001-388B-42BB-B8B3-DE8A9CA62EF6%40gmail.com.


0001-Runtime-vim-python-syntax-supports-trim.patch
Description: Binary data
Test with test.vim: ```py3 << EOFimport ospassEOFpy3 << trim EOFimport ospassEOFpyx  wrote:Please ignore, sorry this patch is broken. I’m clearly having a bad day today :(I will re-send when I fixed it.On 3 Apr 2021, at 15:08, Ben Jackson  wrote:Hi Charles,Sorry for the confusion, here’s the patch attached.<0001-Runtime-vim-python-syntax-supports-trim.patch>Thanks,BenOn 3 Apr 2021, at 14:36, Bram Moolenaar  wrote:Ben Jackson wrote:Hi Charles,Vim 8.1 has supported py3