Re: smoothscroll anomolies

2022-10-07 Fir de Conversatie Ernie Rael

On 10/7/22 2:28 PM, Bram Moolenaar wrote:

On 10/7/22 9:46 AM, Ernie Rael wrote:

On 10/6/22 3:39 AM, Bram Moolenaar wrote:

Ernie Rael wrote:


I built ASAN with 9.0.669,


Since I was setup, I did a "make" in testdir. There was one asan=20
problem
and some test failures that didn't seem too troubling:

For an ASAN log to be useful, I need a way to reproduce it. Ideally a
short script.  Or, when it is from running tests, which test. >  I then
still have to binary search for the cause (commenting out parts of the
testa), which can take time.

Is there a way to associate an asan.### file with a particular test? I
tried doing "ls -lt" and occasionally you can see a some_test.res file
interspersed with the asan files. Something like a timestamp
(optional?) column in messages would do the trick. That would narrow
things down to a few tests.

-ernie

Tracked down the specific test within a particluar test file

 $ make test_listlbr_utf8
 00:00 Executing Test_linebreak_with_list_and_tabs()

This test has a checkered past

 " this was causing a crash
 func Test_linebreak_with_list_and_tabs()

While it's failing here, it there more info I can gather.

=> => ===
==1565972==ERROR: AddressSanitizer: heap-buffer-overflow on address>
0x60b01e34 at pc 0x55ef60917392 bp 0x7ffd02091160 sp 0x7ffd02091150
WRITE of size 1 at 0x60b01e34 thread T0
      #0 0x55ef60917391 in utf_char2bytes /src/tools/vim/src/> mbyte.c:2262
      #1 0x55ef60573b67 in win_line /src/tools/vim/src/drawli> ne.c:2824
      #2 0x55ef605a40e4 in win_update /src/tools/vim/src/draw

[...]


0x60b01e34 is located 0 bytes to the right of 100-byte region
[0x60b01dd0,0x60b01e34)
allocated by thread T0 here:
      #0 0x7fb1a06b4867 in __interceptor_malloc
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
      #1 0x55ef604023af in lalloc /src/tools/vim/src/alloc.c:> 246
      #2 0x55ef6040214e in alloc /src/tools/vim/src/alloc.c:1> 51
      #3 0x55ef605736f7 in win_line /src/tools/vim/src/drawli> ne.c:2802
      #4 0x55ef605a40e4 in win_update /src/tools/vim/src/draw> screen.c:2499

This would mean that the line:

p = alloc(len + 1);

in drawline.c, now at line 2814, does not allocate enough.  "len" is
computed from the size of w_lcs_chars.tab2, but it may also use
wp->w_lcs_chars.tab3, perhaps it takes more bytes?
Could change this line:

len = (tab_len * mb_char2len(wp->w_lcs_chars.tab2));

into:

len = (tab_len * mb_char2len(wp->w_lcs_chars.tab2)
   + mb_char2len(wp->w_lcs_chars.tab3));

I cannot reproduce it, can you try this change?




That change gets rid of the failure. Looking at the code, I noticed that

        if (wlv.n_extra > 0)
            len += wlv.n_extra - tab_len;
could conceivably make len smaller. I put in

        if(wlv.n_extra - tab_len < 0) abort();
and the test crashes

-ernie

--
--
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/a7c18508-8fad-f213-e4e7-c2f8644d3186%40raelity.com.


Re: Patch 9.0.0683

2022-10-07 Fir de Conversatie Bram Moolenaar



John Marriott wrote:

> On 08-Oct-2022 01:11, Bram Moolenaar wrote:
> > Patch 9.0.0683
> > Problem:Cannot specify a time for :echowindow.
> > Solution:   A count can be used to specify the display time. Add
> >  popup_findecho().
> > Files:  runtime/doc/eval.txt, runtime/doc/popup.txt,
> >  runtime/doc/builtin.txt, runtime/doc/usr_41.txt, src/eval.c,
> >  src/popupwin.c, src/proto/popupwin.pro, src/evalfunc.c,
> >  src/ex_cmds.h, src/vim9.h, src/vim9compile.c, 
> > src/vim9execute.c,
> >  src/vim9cmds.c, src/proto/vim9cmds.pro, src/vim9instr.c,
> >  src/proto/vim9instr.pro, src/testdir/test_vim9_disassemble.vim,
> >  src/testdir/test_messages.vim,
> >  src/testdir/dumps/Test_echowindow_8.dump,
> >  src/testdir/dumps/Test_echowindow_9.dump
> >
> >
> After this patch mingw64 (gcc 12.2.0) spits out this warning if 
> HAS_MESSAGE_WINDOW is not defined:
> 
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9compile.c -o 
> gobjnative/vim9compile.o
> vim9compile.c:2691:1: warning: 'get_cmd_count' defined but not used 
> [-Wunused-function]
>   2691 | get_cmd_count(char_u *line, exarg_T *eap)
>    | ^
> 
> 
> The attached patch tries to fix it.

Thanks.  It was intended as a generic function, but only used in one
place right now.

-- 
   "To whoever finds this note -
   I have been imprisoned by my father who wishes me to marry
   against my will.  Please please please please come and rescue me.
   I am in the tall tower of Swamp Castle."
   SIR LAUNCELOT's eyes light up with holy inspiration.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20221007214848.7505B1C0592%40moolenaar.net.


Patch 9.0.0689

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0689
Problem:Compiler warning for unused function.
Solution:   Add #ifdef. (John Marriott)
Files:  src/vim9compile.c


*** ../vim-9.0.0688/src/vim9compile.c   2022-10-07 15:09:24.608804815 +0100
--- src/vim9compile.c   2022-10-07 22:41:56.931810545 +0100
***
*** 2682,2687 
--- 2682,2688 
  return r;
  }
  
+ #ifdef HAS_MESSAGE_WINDOW
  /*
   * Get a count before a command.  Can only be a number.
   * Returns zero if there is no count.
***
*** 2707,2712 
--- 2708,2714 
  }
  return atol((char *)p);
  }
+ #endif
  
  /*
   * Get the compilation type that should be used for "ufunc".
*** ../vim-9.0.0688/src/version.c   2022-10-07 18:51:20.139679475 +0100
--- src/version.c   2022-10-07 22:43:24.167437597 +0100
***
*** 701,702 
--- 701,704 
  {   /* Add new patch number below this line */
+ /**/
+ 689,
  /**/

-- 
Even got a Datapoint 3600(?) with a DD50 connector instead of the
usual DB25...  what a nightmare trying to figure out the pinout
for *that* with no spex...

 /// 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/20221007214848.798601C0C31%40moolenaar.net.


Re: Patch 9.0.0683

2022-10-07 Fir de Conversatie John Marriott


On 08-Oct-2022 01:11, Bram Moolenaar wrote:

Patch 9.0.0683
Problem:Cannot specify a time for :echowindow.
Solution:   A count can be used to specify the display time. Add
 popup_findecho().
Files:  runtime/doc/eval.txt, runtime/doc/popup.txt,
 runtime/doc/builtin.txt, runtime/doc/usr_41.txt, src/eval.c,
 src/popupwin.c, src/proto/popupwin.pro, src/evalfunc.c,
 src/ex_cmds.h, src/vim9.h, src/vim9compile.c, src/vim9execute.c,
 src/vim9cmds.c, src/proto/vim9cmds.pro, src/vim9instr.c,
 src/proto/vim9instr.pro, src/testdir/test_vim9_disassemble.vim,
 src/testdir/test_messages.vim,
 src/testdir/dumps/Test_echowindow_8.dump,
 src/testdir/dumps/Test_echowindow_9.dump


After this patch mingw64 (gcc 12.2.0) spits out this warning if 
HAS_MESSAGE_WINDOW is not defined:


gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9compile.c -o 
gobjnative/vim9compile.o
vim9compile.c:2691:1: warning: 'get_cmd_count' defined but not used 
[-Wunused-function]

 2691 | get_cmd_count(char_u *line, exarg_T *eap)
  | ^


The attached patch tries to fix it.

Cheers
John

--
--
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/a11c12f7-4e5b-5356-2be0-ce6fde1d9c89%40internode.on.net.
--- vim9compile.c.orig  2022-10-08 08:24:06.703862100 +1100
+++ vim9compile.c   2022-10-08 08:34:02.065949600 +1100
@@ -2682,6 +2682,7 @@
 return r;
 }
 
+#ifdef HAS_MESSAGE_WINDOW
 /*
  * Get a count before a command.  Can only be a number.
  * Returns zero if there is no count.
@@ -2707,6 +2708,7 @@
 }
 return atol((char *)p);
 }
+#endif
 
 /*
  * Get the compilation type that should be used for "ufunc".


Re: smoothscroll anomolies

2022-10-07 Fir de Conversatie Bram Moolenaar


Ernie Rael wrote:

> >>> I built ASAN with 9.0.669,
> >>>
> >> Since I was setup, I did a "make" in testdir. There was one asan problem
> >> and some test failures that didn't seem too troubling:
> > For an ASAN log to be useful, I need a way to reproduce it.  Ideally a
> > short script.  Or, when it is from running tests, which test.  I then
> > still have to binary search for the cause (commenting out parts of the
> > testa), which can take time.
> 
> Is there a way to associate an asan.### file with a particular test? I 
> tried doing "ls -lt" and occasionally you can see a some_test.res file 
> interspersed with the asan files. Something like a timestamp (optional?) 
> column in messages would do the trick. That would narrow things down to 
> a few tests.

This is one of the reasons I use valgrind when possible.  It's slow to
execute, but it doesn't require compiling everything and gives more
to-the-point information.  But ASAN can catch different things, e.g. for
items on the stack.

AFAIK that number is the process ID, which is sequentially increasing,
but otherwise does not point to a specific test.  Executing tests one by
one to narrow it down.  Then commenting-out test functions to find out
where it happens, the commenting out lines to pinpoint it...  It takes a
bit of effort.

-- 
FATHER: One day, lad, all this will be yours ...
PRINCE: What - the curtains?
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20221007212825.9AD5E1C10AE%40moolenaar.net.


Re: smoothscroll anomolies

2022-10-07 Fir de Conversatie Bram Moolenaar


> On 10/7/22 9:46 AM, Ernie Rael wrote:
> > On 10/6/22 3:39 AM, Bram Moolenaar wrote:
> >> Ernie Rael wrote:
> >>
>  I built ASAN with 9.0.669,
> 
> >>> Since I was setup, I did a "make" in testdir. There was one asan=20
> >>> problem
> >>> and some test failures that didn't seem too troubling:
> >> For an ASAN log to be useful, I need a way to reproduce it. Ideally a
> >> short script.  Or, when it is from running tests, which test. >  I then
> >> still have to binary search for the cause (commenting out parts of the
> >> testa), which can take time.
> >
> > Is there a way to associate an asan.### file with a particular test? I 
> > tried doing "ls -lt" and occasionally you can see a some_test.res file 
> > interspersed with the asan files. Something like a timestamp 
> > (optional?) column in messages would do the trick. That would narrow 
> > things down to a few tests.
> >
> > -ernie
> 
> Tracked down the specific test within a particluar test file
> 
> $ make test_listlbr_utf8
> 00:00 Executing Test_linebreak_with_list_and_tabs()
> 
> This test has a checkered past
> 
> " this was causing a crash
> func Test_linebreak_with_list_and_tabs()
> 
> While it's failing here, it there more info I can gather.
> 
> => => ===
> ==1565972==ERROR: AddressSanitizer: heap-buffer-overflow on address>  
> 0x60b01e34 at pc 0x55ef60917392 bp 0x7ffd02091160 sp 0x7ffd02091150
> WRITE of size 1 at 0x60b01e34 thread T0
>      #0 0x55ef60917391 in utf_char2bytes /src/tools/vim/src/> mbyte.c:2262
>      #1 0x55ef60573b67 in win_line /src/tools/vim/src/drawli> ne.c:2824
>      #2 0x55ef605a40e4 in win_update /src/tools/vim/src/draw
[...]

> 0x60b01e34 is located 0 bytes to the right of 100-byte region 
> [0x60b01dd0,0x60b01e34)
> allocated by thread T0 here:
>      #0 0x7fb1a06b4867 in __interceptor_malloc 
> ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
>      #1 0x55ef604023af in lalloc /src/tools/vim/src/alloc.c:> 246
>      #2 0x55ef6040214e in alloc /src/tools/vim/src/alloc.c:1> 51
>      #3 0x55ef605736f7 in win_line /src/tools/vim/src/drawli> ne.c:2802
>      #4 0x55ef605a40e4 in win_update /src/tools/vim/src/draw> screen.c:2499

This would mean that the line:

p = alloc(len + 1);

in drawline.c, now at line 2814, does not allocate enough.  "len" is
computed from the size of w_lcs_chars.tab2, but it may also use
wp->w_lcs_chars.tab3, perhaps it takes more bytes?
Could change this line:

len = (tab_len * mb_char2len(wp->w_lcs_chars.tab2));

into:

len = (tab_len * mb_char2len(wp->w_lcs_chars.tab2)
   + mb_char2len(wp->w_lcs_chars.tab3));

I cannot reproduce it, can you try this change?



-- 
FATHER:   Make sure the Prince doesn't leave this room until I come and
  get him.
FIRST GUARD:  Not ... to leave the room ... even if you come and get him.
FATHER:   No.  Until I come and get him.
SECOND GUARD: Hic.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20221007212825.A02931C10E4%40moolenaar.net.


Patch 9.0.0688

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0688 (after 9.0.687)
Problem:Debugger does not display the whole command.
Solution:   Set ea.cmd before checking for a breakpoint.
Files:  src/ex_docmd.c, src/testdir/test_debugger.vim


*** ../vim-9.0.0687/src/ex_docmd.c  2022-10-07 17:26:19.019293893 +0100
--- src/ex_docmd.c  2022-10-07 18:43:25.256445223 +0100
***
*** 1889,1895 
--- 1889,1899 
}
  }
  # endif
+ #endif
+ 
+ ea.cmd = cmd;
  
+ #ifdef FEAT_EVAL
  // May go to debug mode.  If this happens and the ">quit" debug command is
  // used, throw an interrupt exception and skip the next command.
  dbg_check_breakpoint();
***
*** 1935,1941 
  #endif
  }
  
- ea.cmd = cmd;
  if (!may_have_range)
ea.line1 = ea.line2 = default_address();
  else if (parse_cmd_address(, , FALSE) == FAIL)
--- 1939,1944 
*** ../vim-9.0.0687/src/testdir/test_debugger.vim   2022-09-20 
22:01:29.404759229 +0100
--- src/testdir/test_debugger.vim   2022-10-07 18:50:26.471772885 +0100
***
*** 993,999 
call RunDbgCmd(buf, 'step', ['line 1: vim9script'])
call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number'])
call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()'])
-   call RunDbgCmd(buf, 'step', ['line 9: def File2Function()'])
call RunDbgCmd(buf, 'step', ['line 13: defcompile'])
call RunDbgCmd(buf, 'step', ['line 14: File2Function()'])
call RunDbgCmd(buf, 'backtrace', [
--- 993,998 
*** ../vim-9.0.0687/src/version.c   2022-10-07 17:26:19.023293895 +0100
--- src/version.c   2022-10-07 18:44:23.836360138 +0100
***
*** 701,702 
--- 701,704 
  {   /* Add new patch number below this line */
+ /**/
+ 688,
  /**/

-- 
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
ARTHUR:  All right!  What do you want?
TALL KNIGHT: We want ... a shrubbery!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20221007175639.F2BA91C0592%40moolenaar.net.


Re: smoothscroll anomolies

2022-10-07 Fir de Conversatie Ernie Rael

On 10/7/22 9:46 AM, Ernie Rael wrote:

On 10/6/22 3:39 AM, Bram Moolenaar wrote:

Ernie Rael wrote:


I built ASAN with 9.0.669,

Since I was setup, I did a "make" in testdir. There was one asan 
problem

and some test failures that didn't seem too troubling:

For an ASAN log to be useful, I need a way to reproduce it. Ideally a
short script.  Or, when it is from running tests, which test.  I then
still have to binary search for the cause (commenting out parts of the
testa), which can take time.


Is there a way to associate an asan.### file with a particular test? I 
tried doing "ls -lt" and occasionally you can see a some_test.res file 
interspersed with the asan files. Something like a timestamp 
(optional?) column in messages would do the trick. That would narrow 
things down to a few tests.


-ernie


Tracked down the specific test within a particluar test file

   $ make test_listlbr_utf8
   00:00 Executing Test_linebreak_with_list_and_tabs()

This test has a checkered past

   " this was causing a crash
   func Test_linebreak_with_list_and_tabs()

While it's failing here, it there more info I can gather.

=
==1565972==ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x60b01e34 at pc 0x55ef60917392 bp 0x7ffd02091160 sp 0x7ffd02091150

WRITE of size 1 at 0x60b01e34 thread T0
    #0 0x55ef60917391 in utf_char2bytes /src/tools/vim/src/mbyte.c:2262
    #1 0x55ef60573b67 in win_line /src/tools/vim/src/drawline.c:2824
    #2 0x55ef605a40e4 in win_update /src/tools/vim/src/drawscreen.c:2499
    #3 0x55ef60584096 in update_screen /src/tools/vim/src/drawscreen.c:326
    #4 0x55ef6071a4f3 in redraw_cmd /src/tools/vim/src/ex_docmd.c:8357
    #5 0x55ef6071a3d9 in ex_redraw /src/tools/vim/src/ex_docmd.c:8341
    #6 0x55ef606da97c in do_one_cmd /src/tools/vim/src/ex_docmd.c:2561
    #7 0x55ef606cdb1a in do_cmdline /src/tools/vim/src/ex_docmd.c:990
    #8 0x55ef60f775ff in call_user_func /src/tools/vim/src/userfunc.c:2945
    #9 0x55ef60f79590 in call_user_func_check 
/src/tools/vim/src/userfunc.c:3107

    #10 0x55ef60f7e3a5 in call_func /src/tools/vim/src/userfunc.c:3663
    #11 0x55ef60f6acb7 in get_func_tv /src/tools/vim/src/userfunc.c:1841
    #12 0x55ef60f926fa in ex_call_inner /src/tools/vim/src/userfunc.c:5647
    #13 0x55ef60f958e9 in ex_call /src/tools/vim/src/userfunc.c:5971
    #14 0x55ef606da97c in do_one_cmd /src/tools/vim/src/ex_docmd.c:2561
    #15 0x55ef606cdb1a in do_cmdline /src/tools/vim/src/ex_docmd.c:990
    #16 0x55ef60615a5f in ex_execute /src/tools/vim/src/eval.c:6947
    #17 0x55ef606da97c in do_one_cmd /src/tools/vim/src/ex_docmd.c:2561
    #18 0x55ef606cdb1a in do_cmdline /src/tools/vim/src/ex_docmd.c:990
    #19 0x55ef60f775ff in call_user_func /src/tools/vim/src/userfunc.c:2945
    #20 0x55ef60f79590 in call_user_func_check 
/src/tools/vim/src/userfunc.c:3107

    #21 0x55ef60f7e3a5 in call_func /src/tools/vim/src/userfunc.c:3663
    #22 0x55ef60f6acb7 in get_func_tv /src/tools/vim/src/userfunc.c:1841
    #23 0x55ef60f926fa in ex_call_inner /src/tools/vim/src/userfunc.c:5647
    #24 0x55ef60f958e9 in ex_call /src/tools/vim/src/userfunc.c:5971
    #25 0x55ef606da97c in do_one_cmd /src/tools/vim/src/ex_docmd.c:2561
    #26 0x55ef606cdb1a in do_cmdline /src/tools/vim/src/ex_docmd.c:990
    #27 0x55ef60ca52dc in do_source_ext 
/src/tools/vim/src/scriptfile.c:1667

    #28 0x55ef60ca7255 in do_source /src/tools/vim/src/scriptfile.c:1811
    #29 0x55ef60ca188c in cmd_source /src/tools/vim/src/scriptfile.c:1163
    #30 0x55ef60ca1a5d in ex_source /src/tools/vim/src/scriptfile.c:1189
    #31 0x55ef606da97c in do_one_cmd /src/tools/vim/src/ex_docmd.c:2561
    #32 0x55ef606cdb1a in do_cmdline /src/tools/vim/src/ex_docmd.c:990
    #33 0x55ef606cb5df in do_cmdline_cmd /src/tools/vim/src/ex_docmd.c:584
    #34 0x55ef612971b3 in exe_commands /src/tools/vim/src/main.c:3135
    #35 0x55ef6128818c in vim_main2 /src/tools/vim/src/main.c:781
    #36 0x55ef612874c8 in main /src/tools/vim/src/main.c:432
    #37 0x7fb19ea29d8f in __libc_start_call_main 
../sysdeps/nptl/libc_start_call_main.h:58

    #38 0x7fb19ea29e3f in __libc_start_main_impl ../csu/libc-start.c:392
    #39 0x55ef60401ed4 in _start (/src/tools/vim/src/vim+0x1322ed4)

0x60b01e34 is located 0 bytes to the right of 100-byte region 
[0x60b01dd0,0x60b01e34)

allocated by thread T0 here:
    #0 0x7fb1a06b4867 in __interceptor_malloc 
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

    #1 0x55ef604023af in lalloc /src/tools/vim/src/alloc.c:246
    #2 0x55ef6040214e in alloc /src/tools/vim/src/alloc.c:151
    #3 0x55ef605736f7 in win_line /src/tools/vim/src/drawline.c:2802
    #4 0x55ef605a40e4 in win_update /src/tools/vim/src/drawscreen.c:2499
    #5 0x55ef60584096 in update_screen /src/tools/vim/src/drawscreen.c:326
    #6 0x55ef6071a4f3 in redraw_cmd /src/tools/vim/src/ex_docmd.c:8357
    #7 0x55ef6071a3d9 in ex_redraw 

Re: smoothscroll anomolies

2022-10-07 Fir de Conversatie Ernie Rael

On 10/6/22 11:55 AM, Ernie Rael wrote:

On 10/5/22 2:39 PM, Ernie Rael wrote:

On 10/5/22 2:15 PM, Bram Moolenaar wrote:

Ernie Rael wrote:

smoothscroll brings a sigh of relief. (and splitkeep is very cool). 
I'm

not sure if these smoothscroll issues have been mentioned; if so,
apologies for the noise.

vim 9.0.667, smoothscroll, splitkeep=screen

I've got a xxx.properties like

 autoSynch=true
 kind=adHoc
 name=nb-full
 path=file:/ref/nb/src/netbeans/apisupport/timers/ ... ~50K chars

with a monstrous last line.

Open the file, cursor on first line, enter ^E repeatedly, the screen
gets stuck on the long "path=..." line. You can put the cursor 
somewhere
in the middle of the long line, ^E until the cursor gets to the top 
and

it gets stuck.

With the current version I don't see this problem.  What is your
'scrolloff' set to?


scrolloff=0

I just tried

gvim -u NONE -U NONE
:set smoothscroll

Get the same screen stuck when cursor at top of screen and in a long 
line with ^E behavior.


same thing with vim.


Just tried with 9.0.677. Same thing.

Note that if the long line is not the last line it behaves 
differently. If the long line does not extend past the end of the 
screen it works.


Any hints for tracking this down?

If I get some time, some ideas on where to put breakpoints would be 
useful. (have to remember how to use termdebug)


-ernie

--
--
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/26fa4e5e-370d-1809-61fb-df308bdd7a1b%40raelity.com.


Re: smoothscroll anomolies

2022-10-07 Fir de Conversatie Ernie Rael

On 10/6/22 3:39 AM, Bram Moolenaar wrote:

Ernie Rael wrote:


I built ASAN with 9.0.669,


Since I was setup, I did a "make" in testdir. There was one asan problem
and some test failures that didn't seem too troubling:

For an ASAN log to be useful, I need a way to reproduce it.  Ideally a
short script.  Or, when it is from running tests, which test.  I then
still have to binary search for the cause (commenting out parts of the
testa), which can take time.


Is there a way to associate an asan.### file with a particular test? I 
tried doing "ls -lt" and occasionally you can see a some_test.res file 
interspersed with the asan files. Something like a timestamp (optional?) 
column in messages would do the trick. That would narrow things down to 
a few tests.


-ernie



On CI there is also a run with ASAN, thus normally things are caught
there.




--
--
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/fba4c791-d167-a4ca-a355-a7e934cf4ff9%40raelity.com.


Patch 9.0.0687

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0687
Problem:"export def" does not work in a nested block.
Solution:   Do not handle "export" with a separate function but in the same
command stack. (closes #11304)
Files:  src/ex_docmd.c, src/vim9script.c, src/ex_cmds.h,
src/testdir/test_vim9_import.vim


*** ../vim-9.0.0686/src/ex_docmd.c  2022-10-04 16:23:39.014042183 +0100
--- src/ex_docmd.c  2022-10-07 17:18:20.354476923 +0100
***
*** 1820,1825 
--- 1820,1834 
  if (may_have_range)
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
  
+ #ifdef FEAT_EVAL
+ // Handle ":export" - it functions almost like a command modifier.
+ // ":export var Name: type"
+ // ":export def Name(..."
+ // etc.
+ if (vim9script && checkforcmd_noparen(, "export", 6))
+   is_export = TRUE;
+ #endif
+ 
  if (vim9script && !may_have_range)
  {
if (ea.cmd == cmd + 1 && *cmd == '$')
***
*** 2496,2506 
  }
  #endif
  
! if (ea.argt & EX_XFILE)
  {
!   if (expand_filename(, cmdlinep, ) == FAIL)
!   goto doend;
  }
  
  /*
   * Accept buffer name.  Cannot be used at the same time with a buffer
--- 2505,2521 
  }
  #endif
  
! if ((ea.argt & EX_XFILE)
!   && expand_filename(, cmdlinep, ) == FAIL)
!   goto doend;
! 
! #ifdef FEAT_EVAL
! if (is_export && (ea.argt & EX_EXPORT) == 0)
  {
!   emsg(_(e_invalid_command_after_export));
!   goto doend;
  }
+ #endif
  
  /*
   * Accept buffer name.  Cannot be used at the same time with a buffer
***
*** 2557,2569 
/*
 * Call the function to execute the builtin command.
 */
-   ea.errmsg = NULL;
(cmdnames[ea.cmdidx].cmd_func)();
if (ea.errmsg != NULL)
errormsg = ea.errmsg;
  }
  
  #ifdef FEAT_EVAL
  // Set flag that any command was executed, used by ex_vim9script().
  // Not if this was a command that wasn't executed or :endif.
  if (sourcing_a_script()
--- 2572,2592 
/*
 * Call the function to execute the builtin command.
 */
(cmdnames[ea.cmdidx].cmd_func)();
if (ea.errmsg != NULL)
errormsg = ea.errmsg;
  }
  
  #ifdef FEAT_EVAL
+ // A command will reset "is_export" when exporting an item.  If it is 
still
+ // set something went wrong.
+ if (is_export)
+ {
+   if (errormsg == NULL)
+   errormsg = _(e_export_with_invalid_argument);
+   is_export = FALSE;
+ }
+ 
  // Set flag that any command was executed, used by ex_vim9script().
  // Not if this was a command that wasn't executed or :endif.
  if (sourcing_a_script()
***
*** 2620,2625 
--- 2643,2649 
  
  if (did_set_expr_line)
set_expr_line(NULL, NULL);
+ is_export = FALSE;
  #endif
  
  undo_cmdmod();
*** ../vim-9.0.0686/src/vim9script.c2022-10-07 16:00:00.757126668 +0100
--- src/vim9script.c2022-10-07 17:10:12.814159416 +0100
***
*** 246,294 
  }
  
  /*
!  * ":export let Name: type"
!  * ":export const Name: type"
!  * ":export def Name(..."
!  * ":export class Name ..."
   */
  void
! ex_export(exarg_T *eap)
  {
! int   prev_did_emsg = did_emsg;
! 
! if (!in_vim9script())
! {
!   emsg(_(e_export_can_only_be_used_in_vim9script));
!   return;
! }
! 
! eap->cmd = eap->arg;
! (void)find_ex_command(eap, NULL, lookup_scriptitem, NULL);
! switch (eap->cmdidx)
! {
!   case CMD_var:
!   case CMD_final:
!   case CMD_const:
!   case CMD_def:
!   case CMD_function:
!   // case CMD_class:
!   is_export = TRUE;
!   do_cmdline(eap->cmd, eap->getline, eap->cookie,
!   DOCMD_VERBOSE + DOCMD_NOWAIT);
! 
!   // The command will reset "is_export" when exporting an item.
!   if (is_export)
!   {
!   if (did_emsg == prev_did_emsg)
!   emsg(_(e_export_with_invalid_argument));
!   is_export = FALSE;
!   }
!   break;
!   default:
!   if (did_emsg == prev_did_emsg)
!   emsg(_(e_invalid_command_after_export));
!   break;
! }
  }
  
  /*
--- 246,258 
  }
  
  /*
!  * ":export cmd"
   */
  void
! ex_export(exarg_T *eap UNUSED)
  {
! // can only get here when "export" wasn't caught in do_cmdline()
! emsg(_(e_export_can_only_be_used_in_vim9script));
  }
  
  /*
*** ../vim-9.0.0686/src/ex_cmds.h   2022-10-07 14:31:04.320852668 +0100
--- src/ex_cmds.h   2022-10-07 17:05:00.691039541 +0100
***
*** 59,64 
--- 59,65 
  #define EX_KEEPSCRIPT  0x400  // keep sctx of where command was invoked
  #define EX_EXPR_ARG0x800  // argument is an expression
  #define EX_WHOLE  0x1000  // command name cannot be shortened in Vim9
+ #define EX_EXPORT 

Patch 9.0.0686

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0686
Problem:The right ALT key does not work on some MS-Windows keyboards.
Solution:   Adjust the modifiers based on GetKeyState(). (Anoton Sharonov,
closes #11300)
Files:  src/gui_w32.c


*** ../vim-9.0.0685/src/gui_w32.c   2022-10-04 16:23:39.014042183 +0100
--- src/gui_w32.c   2022-10-07 16:27:56.098298182 +0100
***
*** 852,857 
--- 852,864 
modifiers |= MOD_MASK_ALT;
  if ((modifiers & MOD_MASK_CTRL) && (GetKeyState(VK_RMENU) & 0x8000))
modifiers &= ~MOD_MASK_CTRL;
+ // Add RightALT only if it is hold alone (without Ctrl), because if AltGr
+ // is pressed, Windows claims that Ctrl is hold as well. That way we can
+ // recognize Right-ALT alone and be sure that not AltGr is hold.
+ if (!(GetKeyState(VK_CONTROL) & 0x8000)
+   &&  (GetKeyState(VK_RMENU) & 0x8000)
+   && !(GetKeyState(VK_LMENU) & 0x8000)) // seems AltGr has both set
+   modifiers |= MOD_MASK_ALT;
  
  return modifiers;
  }
*** ../vim-9.0.0685/src/version.c   2022-10-07 16:00:00.757126668 +0100
--- src/version.c   2022-10-07 16:28:23.034274878 +0100
***
*** 701,702 
--- 701,704 
  {   /* Add new patch number below this line */
+ /**/
+ 686,
  /**/

-- 
"Never be afraid to tell the world who you are."
-- Anonymous

 /// 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/20221007152921.97B3E1C10AE%40moolenaar.net.


Patch 9.0.0685

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0685
Problem:FORTIFY_SOURCE causes a crash in Vim9 script.
Solution:   Use a pointer to the first char. (Yee Cheng Chin, closes #11302)
Files:  src/vim9script.c


*** ../vim-9.0.0684/src/vim9script.c2022-08-24 16:30:30.690752449 +0100
--- src/vim9script.c2022-10-07 15:53:19.538696834 +0100
***
*** 140,146 
 0L, (char_u *)CPO_VIM, OPT_NO_REDRAW);
  }
  #else
! // No check for this being the first command, it doesn't matter.
  current_sctx.sc_version = SCRIPT_VERSION_VIM9;
  #endif
  }
--- 140,147 
 0L, (char_u *)CPO_VIM, OPT_NO_REDRAW);
  }
  #else
! // No check for this being the first command, the information is not
! // available.
  current_sctx.sc_version = SCRIPT_VERSION_VIM9;
  #endif
  }
***
*** 969,975 
sv->sv_flags |= SVFLAG_ASSIGNED;
newsav->sav_var_vals_idx = si->sn_var_vals.ga_len;
++si->sn_var_vals.ga_len;
!   STRCPY(>sav_key, name);
sv->sv_name = newsav->sav_key;
newsav->sav_di = di;
newsav->sav_block_id = si->sn_current_block_id;
--- 970,977 
sv->sv_flags |= SVFLAG_ASSIGNED;
newsav->sav_var_vals_idx = si->sn_var_vals.ga_len;
++si->sn_var_vals.ga_len;
!   // a pointer to the first char avoids a FORTIFY_SOURCE problem
!   STRCPY(>sav_key[0], name);
sv->sv_name = newsav->sav_key;
newsav->sav_di = di;
newsav->sav_block_id = si->sn_current_block_id;
*** ../vim-9.0.0684/src/version.c   2022-10-07 15:09:24.608804815 +0100
--- src/version.c   2022-10-07 15:54:46.526325288 +0100
***
*** 701,702 
--- 701,704 
  {   /* Add new patch number below this line */
+ /**/
+ 685,
  /**/

-- 
Experience is what you get when you don't get what you want.

 /// 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/20221007150038.EDC391C0592%40moolenaar.net.


Patch 9.0.0683

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0683
Problem:Cannot specify a time for :echowindow.
Solution:   A count can be used to specify the display time. Add
popup_findecho().
Files:  runtime/doc/eval.txt, runtime/doc/popup.txt,
runtime/doc/builtin.txt, runtime/doc/usr_41.txt, src/eval.c,
src/popupwin.c, src/proto/popupwin.pro, src/evalfunc.c,
src/ex_cmds.h, src/vim9.h, src/vim9compile.c, src/vim9execute.c,
src/vim9cmds.c, src/proto/vim9cmds.pro, src/vim9instr.c,
src/proto/vim9instr.pro, src/testdir/test_vim9_disassemble.vim,
src/testdir/test_messages.vim,
src/testdir/dumps/Test_echowindow_8.dump,
src/testdir/dumps/Test_echowindow_9.dump


*** ../vim-9.0.0682/runtime/doc/eval.txt2022-09-17 21:07:52.087993184 
+0100
--- runtime/doc/eval.txt2022-10-07 12:26:56.512246269 +0100
***
*** 3876,3886 
when the screen is redrawn.
  
*:echow* *:echowin* *:echowindow*
! :echow[indow] {expr1} ..
Like |:echomsg| but when the messages popup window is
available the message is displayed there.  This means
it will show for three seconds and avoid a
!   |hit-enter| prompt.
The message window is available when Vim was compiled
with the +timer and the +popupwin features.
  
--- 3392,3408 
when the screen is redrawn.
  
*:echow* *:echowin* *:echowindow*
! :[N]echow[indow] {expr1} ..
Like |:echomsg| but when the messages popup window is
available the message is displayed there.  This means
it will show for three seconds and avoid a
!   |hit-enter| prompt.  If you want to hide it before
!   that, press Esc in Normal mode (when it would
!   otherwise beep).  If it disappears too soon you can
!   use `:messages` to see the text.
!   When [N] is given then the window will show up for
!   this number of seconds.  The last `:echowindow` with a
!   count matters, it is used once only.
The message window is available when Vim was compiled
with the +timer and the +popupwin features.
  
*** ../vim-9.0.0682/runtime/doc/popup.txt   2022-06-28 11:21:06.0 
+0100
--- runtime/doc/popup.txt   2022-10-07 13:26:09.913130845 +0100
***
*** 347,352 
--- 347,358 
See the example here: |popup_dialog-example|
  
  
+ popup_findecho()  *popup_findecho()*
+   Get the |window-ID| for the popup that shows messages for the
+   `:echowindow` command.  Return zero if there is none.
+   Mainly useful to hide the popup.
+ 
+ 
  popup_findinfo()  *popup_findinfo()*
Get the |window-ID| for the popup info window, as it used by
the popup menu.  See |complete-popup|.  The info popup is
*** ../vim-9.0.0682/runtime/doc/builtin.txt 2022-09-29 13:50:04.711222464 
+0100
--- runtime/doc/builtin.txt 2022-10-07 13:26:44.753113159 +0100
***
*** 395,400 
--- 396,402 
  popup_dialog({what}, {options}) Numbercreate a popup window used as a 
dialog
  popup_filter_menu({id}, {key})  Numberfilter for a menu popup window
  popup_filter_yesno({id}, {key}) Numberfilter for a dialog popup window
+ popup_findecho()  Number  get window ID of popup for `:echowin`
  popup_findinfo()  Number  get window ID of info popup window
  popup_findpreview()   Number  get window ID of preview popup window
  popup_getoptions({id})Dictget options of popup window {id}
*** ../vim-9.0.0682/runtime/doc/usr_41.txt  2022-09-12 13:38:01.390578399 
+0100
--- runtime/doc/usr_41.txt  2022-10-07 13:27:50.993070199 +0100
***
*** 1288,1293 
--- 1289,1295 
popup_filter_yesno()block until 'y' or 'n' is pressed
popup_getoptions()  get current options for a popup
popup_getpos()  get actual position and size of a popup
+   popup_findecho()get window ID for popup used for `:echowindow`
popup_findinfo()get window ID for popup info window
popup_findpreview() get window ID for popup preview window
popup_list()get list of all popup window IDs
*** ../vim-9.0.0682/src/eval.c  2022-10-01 19:43:48.602494034 +0100
--- src/eval.c  2022-10-07 12:53:44.961135481 +0100
***
*** 6916,6922 
else if (eap->cmdidx == CMD_echowindow)
{
  #ifdef 

Patch 9.0.0684

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0684 (after 9.0.0683)
Problem:Skipped :exe command fails compilation on MS-Windows.
Solution:   Adjust return value when skipping.
Files:  src/vim9compile.c, src/vim9instr.c


*** ../vim-9.0.0683/src/vim9compile.c   2022-10-07 14:31:04.320852668 +0100
--- src/vim9compile.c   2022-10-07 15:06:10.713458293 +0100
***
*** 3339,3345 
case CMD_echowindow:
{
long cmd_count = get_cmd_count(line, );
!   if (cmd_count >= 0)
line = compile_mult_expr(p, ea.cmdidx,
 cmd_count, );
}
--- 3339,3347 
case CMD_echowindow:
{
long cmd_count = get_cmd_count(line, );
!   if (cmd_count < 0)
!   line = NULL;
!   else
line = compile_mult_expr(p, ea.cmdidx,
 cmd_count, );
}
*** ../vim-9.0.0683/src/vim9instr.c 2022-10-07 14:31:04.324852691 +0100
--- src/vim9instr.c 2022-10-07 15:08:06.209043887 +0100
***
*** 1876,1881 
--- 1876,1882 
  {
  isn_T *isn;
  
+ RETURN_OK_IF_SKIP(cctx);
  if ((isn = generate_instr_drop(cctx, isn_type, count)) == NULL)
return FAIL;
  isn->isn_arg.number = count;
*** ../vim-9.0.0683/src/version.c   2022-10-07 14:31:04.324852691 +0100
--- src/version.c   2022-10-07 15:09:03.592865918 +0100
***
*** 701,702 
--- 701,704 
  {   /* Add new patch number below this line */
+ /**/
+ 684,
  /**/

-- 
E  M  A  C  S
s  e  l  o  h
c  t  t  n  i
a  a t  f
pr  t
eo
 l

 /// 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/20221007141105.866201C0592%40moolenaar.net.


Patch 9.0.0682

2022-10-07 Fir de Conversatie Bram Moolenaar


Patch 9.0.0682
Problem:Crash when popup with deleted timer is closed. (Igbanam
Ogbuluijah)
Solution:   Check the timer still exists. (closes #11301)
Files:  src/window.c, src/time.c, src/proto/time.pro,
src/testdir/test_timers.vim


*** ../vim-9.0.0681/src/window.c2022-10-06 11:38:48.154906022 +0100
--- src/window.c2022-10-07 11:14:48.478345948 +0100
***
*** 5322,5328 
close_buffer(win, win->w_buffer, 0, FALSE, FALSE);
  }
  # if defined(FEAT_TIMERS)
! if (win->w_popup_timer != NULL)
stop_timer(win->w_popup_timer);
  # endif
  vim_free(win->w_frame);
--- 5322,5329 
close_buffer(win, win->w_buffer, 0, FALSE, FALSE);
  }
  # if defined(FEAT_TIMERS)
! // the timer may have been cleared, making the pointer invalid
! if (timer_valid(win->w_popup_timer))
stop_timer(win->w_popup_timer);
  # endif
  vim_free(win->w_frame);
*** ../vim-9.0.0681/src/time.c  2022-09-17 21:07:52.03159 +0100
--- src/time.c  2022-10-07 11:17:50.974349693 +0100
***
*** 777,791 
  return abort;
  }
  
  # if defined(EXITFREE) || defined(PROTO)
  void
  timer_free_all()
  {
- timer_T *timer;
- 
  while (first_timer != NULL)
  {
!   timer = first_timer;
remove_timer(timer);
free_timer(timer);
  }
--- 777,803 
  return abort;
  }
  
+ /*
+  * Return TRUE if "timer" exists in the list of timers.
+  */
+ int
+ timer_valid(timer_T *timer)
+ {
+ if (timer == NULL)
+   return FALSE;
+ for (timer_T *t = first_timer; t != NULL; t = t->tr_next)
+   if (t == timer)
+   return TRUE;
+ return FALSE;
+ }
+ 
  # if defined(EXITFREE) || defined(PROTO)
  void
  timer_free_all()
  {
  while (first_timer != NULL)
  {
!   timer_T *timer = first_timer;
remove_timer(timer);
free_timer(timer);
  }
*** ../vim-9.0.0681/src/proto/time.pro  2022-08-27 21:29:28.257402847 +0100
--- src/proto/time.pro  2022-10-07 11:17:56.342349800 +0100
***
*** 13,18 
--- 13,19 
  long check_due_timer(void);
  void stop_timer(timer_T *timer);
  int set_ref_in_timer(int copyID);
+ int timer_valid(timer_T *timer);
  void timer_free_all(void);
  void f_timer_info(typval_T *argvars, typval_T *rettv);
  void f_timer_pause(typval_T *argvars, typval_T *rettv);
*** ../vim-9.0.0681/src/testdir/test_timers.vim 2022-09-24 17:44:18.962404471 
+0100
--- src/testdir/test_timers.vim 2022-10-07 10:58:58.422313668 +0100
***
*** 137,142 
--- 137,156 
call assert_equal(0, len(info))
  endfunc
  
+ def Test_timer_stopall_with_popup()
+   # Create a popup that times out after ten seconds.
+   # Another timer will fire in half a second and close it early after stopping
+   # all timers.
+   var pop = popup_create('Popup', {time: 1})
+   var tmr = timer_start(500, (_) => {
+ timer_stopall()
+ popup_clear()
+   })
+   sleep 1
+   assert_equal([], timer_info(tmr))
+   assert_equal([], popup_list())
+ enddef
+ 
  func Test_timer_paused()
let g:test_is_flaky = 1
let g:val = 0
*** ../vim-9.0.0681/src/version.c   2022-10-06 21:24:30.537632966 +0100
--- src/version.c   2022-10-07 11:15:21.842346650 +0100
***
*** 701,702 
--- 701,704 
  {   /* Add new patch number below this line */
+ /**/
+ 682,
  /**/

-- 
The psychic said, "God bless you."  I said, "I didn't sneeze."  She
looked deep into my eyes and said, "You will, eventually."  And, damn
if she wasn't right.  Two days later, I sneezed.  --Ellen Degeneres

 /// 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/20221007102201.728141C10AE%40moolenaar.net.