Re: Patch 9.0.1084

2022-12-20 Fir de Conversatie Christopher Plewright

>  The attached patch tries to fix both warnings.

Thanks.

> It seems that the function peek_input_record_buffer() is not used anywhere. 
> So the patch removes it.

Yeah, it’s not used now.
The existing static s_irCache is inner function scoped, so I couldn’t directly 
inject records to it for testing.   Initially, I thought it would make sense 
for the new input_record_buffer to replace s_irCache.   It seems redundant 
having both – and the code could be simplified.  However, the existing “peek” 
functionality has some weird behaviour.  There is a scenario where peek could 
actually pop a record off the buffer, and I wasn’t sure if that’s a bug or 
intentional, and so Bram suggested to leave it if I’m not sure that it’s a bug. 
  I thought I might be able to come back to this later, but for now 
peek_input_record_buffer() is not used, so doesn’t need to be there.
Cheers,
Chris Plewright

-- 
-- 
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/SYBP282MB2695BA7692064C57CC2F94DCDBEA9%40SYBP282MB2695.AUSP282.PROD.OUTLOOK.COM.


Patch 9.0.1085

2022-12-20 Fir de Conversatie Bram Moolenaar


Patch 9.0.1085 (after 9.0.1084)
Problem:Compiler warns for uninitialized variable.
Solution:   Initialize the variable.  Remove unused function. (John Marriott)
Files:  src/os_win32.c


*** ../vim-9.0.1084/src/os_win32.c  2022-12-20 20:01:09.624090908 +
--- src/os_win32.c  2022-12-20 20:45:20.736572469 +
***
*** 193,199 
  int length;
  } input_record_buffer_T;
  static input_record_buffer_T input_record_buffer;
- static int peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength);
  static int read_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength);
  static int write_input_record_buffer(INPUT_RECORD* irEvents, int nLength);
  #endif
--- 193,198 
***
*** 1735,1741 
  int   row;
  int   col;
  int   repeated_click;
! int_u mods;
  int   move;
  
  if (!dict_has_key(args, "row") || !dict_has_key(args, "col"))
--- 1734,1740 
  int   row;
  int   col;
  int   repeated_click;
! int_u mods = 0;
  int   move;
  
  if (!dict_has_key(args, "row") || !dict_has_key(args, "col"))
***
*** 1879,1896 
  }
  return nCount;
  }
- static int
- peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength)
- {
- int nCount = 0;
- input_record_buffer_node_T *temp =  input_record_buffer.head;
- while (nCount < nMaxLength && temp != NULL)
- {
-   irEvents[nCount++] = temp->ir;
-   temp = temp->next;
- }
- return nCount;
- }
  #endif // !FEAT_GUI_MSWIN || VIMDLL
  
  #ifdef FEAT_EVAL
--- 1878,1883 
*** ../vim-9.0.1084/src/version.c   2022-12-20 20:01:09.628090906 +
--- src/version.c   2022-12-20 20:47:17.504385788 +
***
*** 697,698 
--- 697,700 
  {   /* Add new patch number below this line */
+ /**/
+ 1085,
  /**/

-- 
I'm sure that I asked CBuilder to do a "full" install.  Looks like I got
a "fool" install, instead.  Charles E Campbell, Jr, PhD


 /// 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/20221220204819.17FA91C06ED%40moolenaar.net.


Re: Patch 9.0.1084

2022-12-20 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 21-Dec-2022 07:02, Bram Moolenaar wrote:
> > Patch 9.0.1084
> > Problem:Code handling low level MS-Windows events cannot be tested.
> > Solution:   Add test_mswin_event() and tests using it. (Christopher 
> > Plewright,
> >  closes #11622)
> > Files:  runtime/doc/builtin.txt, runtime/doc/testing.txt,
> >  runtime/doc/usr_41.txt, src/evalfunc.c, src/gui_w32.c,
> >  src/os_win32.c, src/proto/gui_w32.pro, src/proto/os_win32.pro,
> >  src/proto/testing.pro, src/term.c, src/testing.c,
> >  src/testdir/Make_all.mak, src/testdir/mouse.vim,
> >  src/testdir/test_gui.vim, src/testdir/test_mswin_event.vim,
> >  src/testdir/test_termcodes.vim
> >
> >
> After this patch, msys64 (clang 15.0.5) reports these warnings:
> 
> clang -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE  os_win32.c -o 
> objx86-64/os_win32.o
> os_win32.c:1760:9: warning: variable 'mods' is used uninitialized 
> whenever 'if' condition is true [-Wsometimes-uninitialized]
>      if (move)
>      ^~~~
> os_win32.c:1826:9: note: uninitialized use occurs here
>      if (mods != 0)
>      ^~~~
> os_win32.c:1760:5: note: remove the 'if' if its condition is always false
>      if (move)
>      ^
> os_win32.c:1738:15: note: initialize the variable 'mods' to silence this 
> warning
>      int_u   mods;
>      ^
>   = 0
> os_win32.c:1883:1: warning: unused function 'peek_input_record_buffer' 
> [-Wunused-function]
> peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength)
> ^
> 2 warnings generated.
> 
> 
> The attached patch tries to fix both warnings.
> 
> It seems that the function peek_input_record_buffer() is not used 
> anywhere. So the patch removes it.

Thanks, I'll include the patch.

-- 
DENNIS:  Listen -- strange women lying in ponds distributing swords is no
 basis for a system of government.  Supreme executive power derives
 from a mandate from the masses, not from some farcical aquatic
 ceremony.
  The Quest for the Holy Grail (Monty Python)

 /// 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/20221220204819.146111C06DC%40moolenaar.net.


Re: Patch 9.0.1084

2022-12-20 Fir de Conversatie John Marriott


On 21-Dec-2022 07:02, Bram Moolenaar wrote:

Patch 9.0.1084
Problem:Code handling low level MS-Windows events cannot be tested.
Solution:   Add test_mswin_event() and tests using it. (Christopher Plewright,
 closes #11622)
Files:  runtime/doc/builtin.txt, runtime/doc/testing.txt,
 runtime/doc/usr_41.txt, src/evalfunc.c, src/gui_w32.c,
 src/os_win32.c, src/proto/gui_w32.pro, src/proto/os_win32.pro,
 src/proto/testing.pro, src/term.c, src/testing.c,
 src/testdir/Make_all.mak, src/testdir/mouse.vim,
 src/testdir/test_gui.vim, src/testdir/test_mswin_event.vim,
 src/testdir/test_termcodes.vim



After this patch, msys64 (clang 15.0.5) reports these warnings:

clang -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE  os_win32.c -o 
objx86-64/os_win32.o
os_win32.c:1760:9: warning: variable 'mods' is used uninitialized 
whenever 'if' condition is true [-Wsometimes-uninitialized]

    if (move)
    ^~~~
os_win32.c:1826:9: note: uninitialized use occurs here
    if (mods != 0)
    ^~~~
os_win32.c:1760:5: note: remove the 'if' if its condition is always false
    if (move)
    ^
os_win32.c:1738:15: note: initialize the variable 'mods' to silence this 
warning

    int_u   mods;
    ^
 = 0
os_win32.c:1883:1: warning: unused function 'peek_input_record_buffer' 
[-Wunused-function]

peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength)
^
2 warnings generated.


The attached patch tries to fix both warnings.

It seems that the function peek_input_record_buffer() is not used 
anywhere. So the patch removes 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/87deea88-7ebb-0ef0-f3b6-c98fa228253a%40internode.on.net.
--- os_win32.c.orig 2022-12-21 07:22:07.211294800 +1100
+++ os_win32.c  2022-12-21 07:28:29.770357500 +1100
@@ -193,7 +193,6 @@
 int length;
 } input_record_buffer_T;
 static input_record_buffer_T input_record_buffer;
-static int peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength);
 static int read_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength);
 static int write_input_record_buffer(INPUT_RECORD* irEvents, int nLength);
 #endif
@@ -1735,7 +1734,7 @@
 introw;
 intcol;
 intrepeated_click;
-int_u  mods;
+int_u  mods = 0;
 intmove;
 
 if (!dict_has_key(args, "row") || !dict_has_key(args, "col"))
@@ -1879,18 +1878,6 @@
 }
 return nCount;
 }
-static int
-peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength)
-{
-int nCount = 0;
-input_record_buffer_node_T *temp =  input_record_buffer.head;
-while (nCount < nMaxLength && temp != NULL)
-{
-   irEvents[nCount++] = temp->ir;
-   temp = temp->next;
-}
-return nCount;
-}
 #endif // !FEAT_GUI_MSWIN || VIMDLL
 
 #ifdef FEAT_EVAL


Patch 9.0.1084

2022-12-20 Fir de Conversatie Bram Moolenaar


Patch 9.0.1084
Problem:Code handling low level MS-Windows events cannot be tested.
Solution:   Add test_mswin_event() and tests using it. (Christopher Plewright,
closes #11622)
Files:  runtime/doc/builtin.txt, runtime/doc/testing.txt,
runtime/doc/usr_41.txt, src/evalfunc.c, src/gui_w32.c,
src/os_win32.c, src/proto/gui_w32.pro, src/proto/os_win32.pro,
src/proto/testing.pro, src/term.c, src/testing.c,
src/testdir/Make_all.mak, src/testdir/mouse.vim,
src/testdir/test_gui.vim, src/testdir/test_mswin_event.vim,
src/testdir/test_termcodes.vim


*** ../vim-9.0.1083/runtime/doc/builtin.txt 2022-12-05 13:50:49.718052362 
+
--- runtime/doc/builtin.txt 2022-12-20 19:22:31.969188032 +
***
*** 666,671 
--- 666,673 
  test_getvalue({string})   any get value of an internal 
variable
  test_gui_event({event}, {args})   boolgenerate a GUI event for testing
  test_ignore_error({expr}) noneignore a specific error
+ test_mswin_event({event}, {args})
+   boolgenerate MS-Windows event for testing
  test_null_blob()  Blobnull value for testing
  test_null_channel()   Channel null value for testing
  test_null_dict()  Dictnull value for testing
*** ../vim-9.0.1083/runtime/doc/testing.txt 2022-07-23 05:04:07.580839529 
+0100
--- runtime/doc/testing.txt 2022-12-20 19:27:27.353314009 +
***
*** 94,100 
"findrepl"  search and replace text.
"mouse" mouse button click event.
"scrollbar" move or drag the scrollbar.
!   "sendevent" send a low-level GUI event.
"tabline"   select a tab page by mouse click.
"tabmenu"   select a tabline menu entry.
  
--- 94,100 
"findrepl"  search and replace text.
"mouse" mouse button click event.
"scrollbar" move or drag the scrollbar.
!   "key"   send a low-level keyboard event.
"tabline"   select a tab page by mouse click.
"tabmenu"   select a tabline menu entry.
  
***
*** 135,143 
  Inject either a mouse button click, or a mouse move, event.
  The supported items in {args} are:
button: mouse button.  The supported values are:
!   0   right mouse button
1   middle mouse button
!   2   left mouse button
3   mouse button release
4   scroll wheel down
5   scroll wheel up
--- 135,143 
  Inject either a mouse button click, or a mouse move, event.
  The supported items in {args} are:
button: mouse button.  The supported values are:
!   0   left mouse button
1   middle mouse button
!   2   right mouse button
3   mouse button release
4   scroll wheel down
5   scroll wheel up
***
*** 178,191 
dragging:   1 to drag the scrollbar and 0 to click in the
scrollbar.
  
!   "sendevent":
! Send a low-level GUI event (e.g. key-up or down).
  Currently only supported on MS-Windows.
  The supported items in {args} are:
event:  The supported string values are:
keyup   generate a keyup event
keydown generate a keydown event
keycode:Keycode to use for a keyup or a keydown event.
  
"tabline":
  Inject a mouse click event on the tabline to select a
--- 178,192 
dragging:   1 to drag the scrollbar and 0 to click in the
scrollbar.
  
!   "key":
! Send a low-level keyboard event (e.g. key-up or down).
  Currently only supported on MS-Windows.
  The supported items in {args} are:
event:  The supported string values are:
keyup   generate a keyup event
keydown generate a keydown event
keycode:Keycode to use for a keyup or a keydown event.
+   *E1291*
  
"tabline":
  Inject a mouse click event on 

Re: [vim/vim] Remove 'r' and 'o' from formatoptions. (PR #11700)

2022-12-20 Fir de Conversatie Gary Johnson
On 2022-12-20, madjxatw wrote:
> This behavior is really annoying! Whether to insert a comment leader should be
> decided by user but not assumed by the editor. Most of the time when placing a
> short trailing comment, I don't want a comment continuation. At least o should
> be removed.

>From my vimrc:

autocmd FileType * setlocal formatoptions-=o
" Override any filetype plugin's attempt
" to set the 'fo' 'o' option, which inserts
" a comment leader when opening a new line.

HTH,
Gary

-- 
-- 
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/20221220181246.GD6446%40phoenix.


Patch 9.0.1083

2022-12-20 Fir de Conversatie Bram Moolenaar


Patch 9.0.1083
Problem:Empty and comment lines in a class cause an error.
Solution:   Skip empty and comment lines. (closes #11734)
Files:  src/vim9class.c, src/testdir/test_vim9_class.vim


*** ../vim-9.0.1082/src/vim9class.c 2022-12-19 12:18:06.404218717 +
--- src/vim9class.c 2022-12-20 13:34:57.060327373 +
***
*** 248,253 
--- 248,263 
break;
char_u *line = skipwhite(theline);
  
+   // Skip empty and comment lines.
+   if (*line == NUL)
+   continue;
+   if (*line == '#')
+   {
+   if (vim9_bad_comment(line))
+   break;
+   continue;
+   }
+ 
char_u *p = line;
if (checkforcmd(, "endclass", 4))
{
*** ../vim-9.0.1082/src/testdir/test_vim9_class.vim 2022-12-18 
21:42:49.014716925 +
--- src/testdir/test_vim9_class.vim 2022-12-20 13:37:34.984409558 +
***
*** 131,136 
--- 131,137 
  this.lnum: number
  this.col: number
  
+ # make a nicely formatted string
  def ToString(): string
return $'({this.lnum}, {this.col})'
  enddef
***
*** 155,160 
--- 156,162 
  this.lnum: number = 1
  this.col: number = 1
  
+ # constructor with only the line number
  def new(lnum: number)
this.lnum = lnum
  enddef
*** ../vim-9.0.1082/src/version.c   2022-12-19 20:42:45.884055099 +
--- src/version.c   2022-12-20 13:35:53.608365913 +
***
*** 697,698 
--- 697,700 
  {   /* Add new patch number below this line */
+ /**/
+ 1083,
  /**/

-- 
ARTHUR:  Be quiet!
DENNIS:  --but by a two-thirds majority in the case of more--
ARTHUR:  Be quiet!  I order you to be quiet!
WOMAN:   Order, eh -- who does he think he is?
ARTHUR:  I am your king!
  The Quest for the Holy Grail (Monty Python)

 /// 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/20221220133857.B5D7D1C06DC%40moolenaar.net.


Re: Choices for Vim9 class implementation

2022-12-20 Fir de Conversatie puremo...@gmail.com
For what it's worth, I feel that the formal "var memberVariable : Type" 
syntax for member is (while more verbose) more likely to stand out. The 
`var` keyword is a signpost and so is likely to be syntax highlighted. 
Simple `memberVariable : Type` doesn't stand out anywhere and contains 
mostly identifiers without keywords.

Additionally, I personally prefer the symmetry with local variables. If all 
declarations look the same, then it's one less rule to remember.

You can then also use const: `const memberVarConstant : Type` maybe?

On Tuesday, December 20, 2022 at 12:30:50 AM UTC ch...@createng.com wrote:

>
>> The difference between a regular method and a constructor is that for a 
>> constructor it is very common to assign the argument to an object 
>> member. 
>>
>> The idea comes from Dart, and I don't think Dart supports this for 
>> anything but constructors.
>>
>
> That's a good point, it is usually constructors where it get tedious.
> I really appreciate your considered replies.  
> Thanks
>  
>

-- 
-- 
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/2b98f2fa-d3d4-4ae3-bd49-1cfe4e18b714n%40googlegroups.com.