Re: Patch 8.2.4792

2022-04-19 Fir de Conversatie Tony Mechelynck
On Tue, Apr 19, 2022 at 10:07 PM John Marriott
 wrote:
>
> After this patch, mingw (gcc 11.2.0) throws this warning:
> 
> 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 indent.c -o
> gobjnative/indent.o
> indent.c: In function 'op_reindent':
> indent.c:1118:34: warning: 'i' may be used uninitialized in this
> function [-Wmaybe-uninitialized]
>   1118 | i = oap->line_count - (i + 1);
>|   ~~~^~~~
> 

I get the same warning on Linux in gcc 11.2.1 in Normal, Big and Huge builds.
>
> The attached patch tries to fix it.
>
> Cheers
> John

Best regards,
Tony.

-- 
-- 
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/CAJkCKXsNs0Hu%2B13xdO8rfqhTYWZeN4wMPwaj4qT2Juefnj-%2Bjw%40mail.gmail.com.


Re: syntax file plsql.vim maintainer not reachable. Have patch.

2022-04-19 Fir de Conversatie Lee Lindley
Bram,

I stopped squirming and will cowboy up as the maintainer. If someone who is 
more in-tune with the vim API wants to take over, I will stand aside.

You said "send me the updated version of the file". You can retrieve it 
from:

https://github.com/lee-lindley/vim_plsql_syntax/blob/main/syntax/plsql.vim

which is tagged as "r1.0" in my github repository. There is a README.md, 
test file, and screenshots in that repository as well.

If you meant to literally send you the file, as in attach a zip, or if you 
meant to fork vim and send you a pull request, please let me know. I'm 
happy to do whatever is required.

Thanks and regards,

Lee

On Sunday, April 17, 2022 at 5:18:45 PM UTC-4 Lee Lindley wrote:

> acknowledged. Thanks Bram.
>
> On Sunday, April 17, 2022 at 4:37:40 PM UTC-4 Bram Moolenaar wrote:
>
>>
>> Lee Lindley wrote:
>>
>> > The listed maintainer email address for syntax file plsql.vim returns 
>> mail
>> > as undeliverable and his online presence has not been updated in many 
>> years.
>> > The syntax file has not kept up with changes to Oracle (19c is now
>> > mainstream while syntax file only supports through 9i). 
>> > I have an update ( https://github.com/lee-lindley/vim_plsql_syntax ) 
>> and
>> > demonstrate decent test coverage in my screenshots. I can generate a 
>> pull
>> > request, but the instructions in CONTRIBUTING.md say to contact the
>> > maintainer first.
>> > Please advise.
>> > PS
>> > I don't have a "test" to add per se, but have a sample pl/sql file that
>> > exercises much of the trickier syntax parsing I'm interested in. I'm
>> > eyeballing it. If there is a separate document for creating test 
>> scripts or
>> > examples for coverage checks on syntax files, please point me to it. 
>> > I don't particularly want to be the maintainer, but I have the Oracle 
>> PL/SQL
>> > experience to be a subject matter expert and will do it if nobody else 
>> will
>> > step up. Being a backup person who the maintainer could reach out to 
>> would
>> > be my preference. 
>> > 
>> > " Vim syntax file
>> > " Language: Oracle Procedureal SQL (PL/SQL)
>> > " Maintainer: Jeff Lanzarotta (jefflanzarotta at yahoo dot com)
>> > " Original Maintainer: C. Laurence Gonsalves (clgo...@kami.com
>> >  )
>> > " URL: http://lanzarotta.tripod.com/vim/syntax/plsql.vim.zip
>> > " Last Change: September 18, 2002
>> > " History: Geoff Evans & Bill Pribyl (bill at plnet dot org)
>> > " Added 9i keywords.
>> > " Austin Ziegler (austin at halostatue dot ca)
>> > " Added 8i+ features.
>>
>> Since the listed maintainer is not responding, please do send me the
>> updated version of the file.
>>
>> If you do not want to be listed as the maintainer, please update the
>> header to change "Maintainer" to "Previous Maintainer", add "Maintaner:
>> vacancy" and add "Last Update" with your info. That should best reflect
>> the situation.
>>
>> -- 
>> hundred-and-one symptoms of being an internet addict:
>> 17. You turn on your intercom when leaving the room so you can hear if new
>> e-mail arrives.
>>
>> /// Bram Moolenaar -- br...@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/45df988a-1de9-4d65-b888-cbba100640e2n%40googlegroups.com.


Patch 8.2.4792

2022-04-19 Fir de Conversatie John Marriott

After this patch, mingw (gcc 11.2.0) throws this warning:

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 indent.c -o 
gobjnative/indent.o

indent.c: In function 'op_reindent':
indent.c:1118:34: warning: 'i' may be used uninitialized in this 
function [-Wmaybe-uninitialized]

 1118 | i = oap->line_count - (i + 1);
  |   ~~~^~~~


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/1dd96083-42d1-fe7c-1ad9-5de8c3fc9efb%40internode.on.net.
--- indent.c.orig   2022-04-20 05:43:23.489963300 +1000
+++ indent.c2022-04-20 05:48:25.280911900 +1000
@@ -1046,7 +1046,7 @@
 void
 op_reindent(oparg_T *oap, int (*how)(void))
 {
-long   i;
+long   i = 0;
 char_u *l;
 intamount;
 linenr_T   first_changed = 0;


Patch 8.2.4793

2022-04-19 Fir de Conversatie Bram Moolenaar


Patch 8.2.4793
Problem:Recognizing Maxima filetype even though it might be another.
Solution:   Remove *.mc and *.dem patterns from Maxima files
Files:  runtime/filetype.vim, src/testdir/test_filetype.vim


*** ../vim-8.2.4792/runtime/filetype.vim2022-04-19 15:29:53.609940094 
+0100
--- runtime/filetype.vim2022-04-19 19:32:41.337757677 +0100
***
*** 155,172 
\   setf aspvbs |
\ endif
  
! " Grub (must be before catch *.lst)
  au BufNewFile,BufRead 
*/boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub
  
  " Maxima, see:
  " 
https://maxima.sourceforge.io/docs/manual/maxima_71.html#file_005ftype_005fmaxima
! au BufNewFile,BufRead *.mc,*.demo,*.dem,*.dm{1,2,3,t},*.wxm,maxima-init.mac 
setf maxima
  
  " Assembly (all kinds)
  " *.lst is not pure assembly, it has two extra columns (address, byte codes)
  au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm()
  
! " Macro (VAX)
  au BufNewFile,BufRead *.mar   setf vmasm
  
  " Atlas
--- 155,175 
\   setf aspvbs |
\ endif
  
! " Grub (must be before pattern *.lst)
  au BufNewFile,BufRead 
*/boot/grub/menu.lst,*/boot/grub/grub.conf,*/etc/grub.conf setf grub
  
  " Maxima, see:
  " 
https://maxima.sourceforge.io/docs/manual/maxima_71.html#file_005ftype_005fmaxima
! " Must be before the pattern *.mac.
! " *.dem omitted - also used by gnuplot demos
! " *.mc omitted - used by dist#ft#McSetf()
! au BufNewFile,BufRead *.demo,*.dm{1,2,3,t},*.wxm,maxima-init.mac setf maxima
  
  " Assembly (all kinds)
  " *.lst is not pure assembly, it has two extra columns (address, byte codes)
  au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm()
  
! " Assembly - Macro (VAX)
  au BufNewFile,BufRead *.mar   setf vmasm
  
  " Atlas
***
*** 1682,1688 
  " Sendmail
  au BufNewFile,BufRead sendmail.cf setf sm
  
! " Sendmail .mc files are actually m4.  Could also be MS Message text file.
  au BufNewFile,BufRead *.mccall dist#ft#McSetf()
  
  " Services
--- 1685,1692 
  " Sendmail
  au BufNewFile,BufRead sendmail.cf setf sm
  
! " Sendmail .mc files are actually m4.  Could also be MS Message text file or
! " Maxima.
  au BufNewFile,BufRead *.mccall dist#ft#McSetf()
  
  " Services
*** ../vim-8.2.4792/src/testdir/test_filetype.vim   2022-04-19 
15:29:53.609940094 +0100
--- src/testdir/test_filetype.vim   2022-04-19 19:31:10.085803595 +0100
***
*** 338,344 
  \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 
'file.mdwn', 'file.md'],
  \ 'mason': ['file.mason', 'file.mhtml', 'file.comp'],
  \ 'master': ['file.mas', 'file.master'],
! \ 'maxima': ['file.mc', 'file.demo', 'file.dem', 'file.dmt', 'file.dm1', 
'file.dm2', 'file.dm3',
  \'file.wxm', 'maxima-init.mac'],
  \ 'mel': ['file.mel'],
  \ 'meson': ['meson.build', 'meson_options.txt'],
--- 338,344 
  \ 'markdown': ['file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 
'file.mdwn', 'file.md'],
  \ 'mason': ['file.mason', 'file.mhtml', 'file.comp'],
  \ 'master': ['file.mas', 'file.master'],
! \ 'maxima': ['file.demo', 'file.dmt', 'file.dm1', 'file.dm2', 'file.dm3',
  \'file.wxm', 'maxima-init.mac'],
  \ 'mel': ['file.mel'],
  \ 'meson': ['meson.build', 'meson_options.txt'],
*** ../vim-8.2.4792/src/version.c   2022-04-19 18:28:41.399860394 +0100
--- src/version.c   2022-04-19 19:33:55.921719721 +0100
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 4793,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
13. Go to a poetry recital and ask why the poems don't rhyme.

 /// 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/20220419183908.4268E1C04AA%40moolenaar.net.


Patch 8.2.4792

2022-04-19 Fir de Conversatie Bram Moolenaar


Patch 8.2.4792
Problem:Indent operator creates an undo entry for every line.
Solution:   Create one undo entry for all lines. (closes #10227)
Files:  src/indent.c, src/testdir/test_indent.vim


*** ../vim-8.2.4791/src/indent.c2022-02-21 19:36:08.143004133 +
--- src/indent.c2022-04-19 18:26:44.135894727 +0100
***
*** 1060,1099 
return;
  }
  
! for (i = oap->line_count; --i >= 0 && !got_int; )
! {
!   // it's a slow thing to do, so give feedback so there's no worry that
!   // the computer's just hung.
  
!   if (i > 1
!   && (i % 50 == 0 || i == oap->line_count - 1)
!   && oap->line_count > p_report)
!   smsg(_("%ld lines to indent... "), i);
  
!   // Be vi-compatible: For lisp indenting the first line is not
!   // indented, unless there is only one line.
  # ifdef FEAT_LISP
!   if (i != oap->line_count - 1 || oap->line_count == 1
!   || how != get_lisp_indent)
  # endif
-   {
-   l = skipwhite(ml_get_curline());
-   if (*l == NUL)  // empty or blank line
-   amount = 0;
-   else
-   amount = how(); // get the indent for this line
- 
-   if (amount >= 0 && set_indent(amount, SIN_UNDO))
{
!   // did change the indent, call changed_lines() later
!   if (first_changed == 0)
!   first_changed = curwin->w_cursor.lnum;
!   last_changed = curwin->w_cursor.lnum;
}
}
-   ++curwin->w_cursor.lnum;
-   curwin->w_cursor.col = 0;  // make sure it's valid
- }
  
  // put cursor on first non-blank of indented line
  curwin->w_cursor.lnum = start_lnum;
--- 1060,1103 
return;
  }
  
! // Save for undo.  Do this once for all lines, much faster than doing this
! // for each line separately, especially when undoing.
! if (u_savecommon(start_lnum - 1, start_lnum + oap->line_count,
!start_lnum + oap->line_count, FALSE) == OK)
!   for (i = oap->line_count; --i >= 0 && !got_int; )
!   {
!   // it's a slow thing to do, so give feedback so there's no worry
!   // that the computer's just hung.
  
!   if (i > 1
!   && (i % 50 == 0 || i == oap->line_count - 1)
!   && oap->line_count > p_report)
!   smsg(_("%ld lines to indent... "), i);
  
!   // Be vi-compatible: For lisp indenting the first line is not
!   // indented, unless there is only one line.
  # ifdef FEAT_LISP
!   if (i != oap->line_count - 1 || oap->line_count == 1
!|| how != get_lisp_indent)
  # endif
{
!   l = skipwhite(ml_get_curline());
!   if (*l == NUL)  // empty or blank line
!   amount = 0;
!   else
!   amount = how(); // get the indent for this line
! 
!   if (amount >= 0 && set_indent(amount, 0))
!   {
!   // did change the indent, call changed_lines() later
!   if (first_changed == 0)
!   first_changed = curwin->w_cursor.lnum;
!   last_changed = curwin->w_cursor.lnum;
!   }
}
+   ++curwin->w_cursor.lnum;
+   curwin->w_cursor.col = 0;  // make sure it's valid
}
  
  // put cursor on first non-blank of indented line
  curwin->w_cursor.lnum = start_lnum;
*** ../vim-8.2.4791/src/testdir/test_indent.vim 2021-12-06 19:50:57.706620019 
+
--- src/testdir/test_indent.vim 2022-04-19 18:24:41.551926208 +0100
***
*** 59,64 
--- 59,87 
close!
  endfunc
  
+ " Test indent operator creating one undo entry
+ func Test_indent_operator_undo()
+   enew
+   call setline(1, range(12)->map('"\t" .. v:val'))
+   func FoldExpr()
+ let g:foldcount += 1
+ return '='
+   endfunc
+   set foldmethod=expr foldexpr=FoldExpr()
+   let g:foldcount = 0
+   redraw
+   call assert_equal(12, g:foldcount)
+   normal gg=G
+   call assert_equal(24, g:foldcount)
+   undo
+   call assert_equal(38, g:foldcount)
+ 
+   bwipe!
+   set foldmethod& foldexpr=
+   delfunc FoldExpr
+   unlet g:foldcount
+ endfunc
+ 
  " Test for shifting a line with a preprocessor directive ('#')
  func Test_preproc_indent()
new
*** ../vim-8.2.4791/src/version.c   2022-04-19 16:24:08.607559706 +0100
--- src/version.c   2022-04-19 18:15:21.612131848 +0100
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 4792,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
12. Sing along at the opera.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///

Patch 8.2.4791

2022-04-19 Fir de Conversatie Bram Moolenaar


Patch 8.2.4791
Problem:Autocmd events triggered in different order when reusing an empty
buffer.
Solution:   Call buff_freeall() earlier. (Charlie Groves, closes #10198)
Files:  src/buffer.c, src/testdir/test_autocmd.vim


*** ../vim-8.2.4790/src/buffer.c2022-04-10 17:59:23.339015279 +0100
--- src/buffer.c2022-04-19 16:23:37.943580814 +0100
***
*** 2068,2077 
buf = curbuf;
// It's like this buffer is deleted.  Watch out for autocommands that
// change curbuf!  If that happens, allocate a new buffer anyway.
!   if (curbuf->b_p_bl)
!   apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
!   if (buf == curbuf)
!   apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
  #ifdef FEAT_EVAL
if (aborting()) // autocmds may abort script processing
{
--- 2068,2076 
buf = curbuf;
// It's like this buffer is deleted.  Watch out for autocommands that
// change curbuf!  If that happens, allocate a new buffer anyway.
!   buf_freeall(buf, BFA_WIPE | BFA_DEL);
!   if (buf != curbuf)   // autocommands deleted the buffer!
!   return NULL;
  #ifdef FEAT_EVAL
if (aborting()) // autocmds may abort script processing
{
***
*** 2079,2090 
return NULL;
}
  #endif
-   if (buf == curbuf)
-   {
-   // Make sure 'bufhidden' and 'buftype' are empty
-   clear_string_option(&buf->b_p_bh);
-   clear_string_option(&buf->b_p_bt);
-   }
  }
  if (buf != curbuf || curbuf == NULL)
  {
--- 2078,2083 
***
*** 2132,2145 
  
  if (buf == curbuf)
  {
-   // free all things allocated for this buffer
-   buf_freeall(buf, 0);
-   if (buf != curbuf)   // autocommands deleted the buffer!
-   return NULL;
- #if defined(FEAT_EVAL)
-   if (aborting()) // autocmds may abort script processing
-   return NULL;
- #endif
free_buffer_stuff(buf, FALSE);  // delete local variables et al.
  
// Init the options.
--- 2125,2130 
*** ../vim-8.2.4790/src/testdir/test_autocmd.vim2022-04-12 
11:32:41.428327316 +0100
--- src/testdir/test_autocmd.vim2022-04-19 16:08:27.300227840 +0100
***
*** 3037,3045 
  endfunc
  
  func Test_autocmd_vimgrep()
augroup aucmd_vimgrep
! au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * sb
! au QuickfixCmdPre,BufNew,BufDelete,BufReadCmd * q9

-- 
-- 
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/20220419152446.AC4471C0796%40moolenaar.net.


Patch 8.2.4790

2022-04-19 Fir de Conversatie Bram Moolenaar


Patch 8.2.4790
Problem:Lilypond filetype not recognized.
Solution:   Add patterns for lilypond. (Doug Kearns)
Files:  runtime/filetype.vim, src/testdir/test_filetype.vim


*** ../vim-8.2.4789/runtime/filetype.vim2022-04-18 14:32:39.654029925 
+0100
--- runtime/filetype.vim2022-04-19 15:25:34.594092460 +0100
***
*** 1017,1022 
--- 1017,1025 
  " Lilo: Linux loader
  au BufNewFile,BufRead lilo.conf   setf lilo
  
+ " Lilypond
+ au BufNewFile,BufRead *.ly,*.ily  setf lilypond
+ 
  " Lisp (*.el = ELisp, *.cl = Common Lisp)
  " *.jl was removed, it's also used for Julia, better skip than guess wrong.
  if has("fname_case")
*** ../vim-8.2.4789/src/testdir/test_filetype.vim   2022-04-18 
14:32:39.654029925 +0100
--- src/testdir/test_filetype.vim   2022-04-19 15:25:34.594092460 +0100
***
*** 306,311 
--- 306,312 
  \ 'libao': ['/etc/libao.conf', '/.libao', 'any/.libao', 
'any/etc/libao.conf'],
  \ 'lifelines': ['file.ll'],
  \ 'lilo': ['lilo.conf', 'lilo.conf-file'],
+ \ 'lilypond': ['file.ly', 'file.ily'],
  \ 'limits': ['/etc/limits', '/etc/anylimits.conf', 
'/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', 
'/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 
'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 
'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'],
  \ 'liquid': ['file.liquid'],
  \ 'lisp': ['file.lsp', 'file.lisp', 'file.asd', 'file.el', 'file.cl', 
'.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'],
*** ../vim-8.2.4789/src/version.c   2022-04-19 11:38:01.484066480 +0100
--- src/version.c   2022-04-19 15:29:37.561949656 +0100
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 4790,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
8. Don't use any punctuation marks.

 /// 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/20220419143025.215D31C0796%40moolenaar.net.


Patch 8.2.4789

2022-04-19 Fir de Conversatie Bram Moolenaar


Patch 8.2.4789
Problem:The cursor may be in the in wrong place when using :redraw while
editing the cmdline.
Solution:   When editing the command line let :redraw update the command line
too. (closes #10210)
Files:  src/ex_docmd.c, src/testdir/test_cmdline.vim,
src/testdir/dumps/Test_redraw_in_autocmd_1.dump,
src/testdir/dumps/Test_redraw_in_autocmd_2.dump


*** ../vim-8.2.4788/src/ex_docmd.c  2022-04-16 18:52:13.225151870 +0100
--- src/ex_docmd.c  2022-04-19 11:36:47.772216989 +0100
***
*** 8323,8328 
--- 8323,8332 
  // No need to wait after an intentional redraw.
  need_wait_return = FALSE;
  
+ // When invoked from a callback or autocmd the command line may be active.
+ if (State & CMDLINE)
+   redrawcmdline();
+ 
  out_flush();
  }
  
*** ../vim-8.2.4788/src/testdir/test_cmdline.vim2022-04-11 
19:38:15.915471119 +0100
--- src/testdir/test_cmdline.vim2022-04-19 11:35:42.828367202 +0100
***
*** 193,198 
--- 193,220 
call delete('XTest_wildmenu')
  endfunc
  
+ func Test_redraw_in_autocmd()
+   CheckScreendump
+ 
+   let lines =<< trim END
+   set cmdheight=2
+   autocmd CmdlineChanged * redraw
+   END
+   call writefile(lines, 'XTest_redraw')
+ 
+   let buf = RunVimInTerminal('-S XTest_redraw', {'rows': 8})
+   call term_sendkeys(buf, ":for i in range(3)\")
+   call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_1', {})
+ 
+   call term_sendkeys(buf, "let i =")
+   call VerifyScreenDump(buf, 'Test_redraw_in_autocmd_2', {})
+ 
+   " clean up
+   call term_sendkeys(buf, "\")
+   call StopVimInTerminal(buf)
+   call delete('XTest_redraw')
+ endfunc
+ 
  func Test_map_completion()
call feedkeys(":map  \\"\", 'xt')
call assert_equal('"map  ', getreg(':'))
*** ../vim-8.2.4788/src/testdir/dumps/Test_redraw_in_autocmd_1.dump 
2022-04-19 11:37:43.532101331 +0100
--- src/testdir/dumps/Test_redraw_in_autocmd_1.dump 2022-04-19 
11:32:49.724866769 +0100
***
*** 0 
--- 1,8 
+ | +0&#ff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#000&|f|o|r| |i| |i|n| |r|a|n|g|e|(|3|)| @56
+ |:| @1> @71
*** ../vim-8.2.4788/src/testdir/dumps/Test_redraw_in_autocmd_2.dump 
2022-04-19 11:37:43.536101322 +0100
--- src/testdir/dumps/Test_redraw_in_autocmd_2.dump 2022-04-19 
11:32:50.784863200 +0100
***
*** 0 
--- 1,8 
+ | +0&#ff0@74
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |:+0#000&| @1|l|e|t| |i| |=> @64
+ @75
*** ../vim-8.2.4788/src/version.c   2022-04-19 10:25:04.249373674 +0100
--- src/version.c   2022-04-19 11:19:46.756317301 +0100
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 4789,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
   over their caffeine addictions, switch to espresso.

 /// 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/20220419103851.3CDED1C0796%40moolenaar.net.


Patch 8.2.4788

2022-04-19 Fir de Conversatie Bram Moolenaar


Patch 8.2.4788
Problem:Large payload for LSP message not tested.
Solution:   Add a test with a large LSP payload. (Yegappan Lakshmanan,
closes #10223)
Files:  src/channel.c, src/testdir/test_channel.vim,
src/testdir/test_channel_lsp.py


*** ../vim-8.2.4787/src/channel.c   2022-04-18 14:07:42.538262252 +0100
--- src/channel.c   2022-04-19 10:21:27.853706364 +0100
***
*** 2031,2036 
--- 2031,2038 
   * Collapses the first and second buffer for "channel"/"part".
   * Returns FAIL if that is not possible.
   * When "want_nl" is TRUE collapse more buffers until a NL is found.
+  * When the channel part mode is "lsp", collapse all the buffers as the http
+  * header and the JSON content can be present in multiple buffers.
   */
  int
  channel_collapse(channel_T *channel, ch_part_T part, int want_nl)
*** ../vim-8.2.4787/src/testdir/test_channel.vim2022-04-18 
14:07:42.538262252 +0100
--- src/testdir/test_channel.vim2022-04-19 10:21:27.853706364 +0100
***
*** 2466,2472 
  endfunc
  
  func LspTests(port)
!   " call ch_logfile('Xlsprpc.log', 'w')
let ch = ch_open(s:localhost .. a:port, #{mode: 'lsp', callback: 'LspCb'})
if ch_status(ch) == "fail"
  call assert_report("Can't open the lsp channel")
--- 2466,2472 
  endfunc
  
  func LspTests(port)
!   " call ch_logfile('Xlspclient.log', 'w')
let ch = ch_open(s:localhost .. a:port, #{mode: 'lsp', callback: 'LspCb'})
if ch_status(ch) == "fail"
  call assert_report("Can't open the lsp channel")
***
*** 2620,2625 
--- 2620,2635 
" send a ping to make sure communication still works
call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
  
+   " Test for a large payload
+   let content = repeat('abcdef', 11000)
+   let resp = ch_evalexpr(ch, #{method: 'large-payload',
+ \ params: #{text: content}})
+   call assert_equal(#{jsonrpc: '2.0', id: 26, result:
+ \ #{method: 'large-payload', jsonrpc: '2.0', id: 26,
+ \ params: #{text: content}}}, resp)
+   " send a ping to make sure communication still works
+   call assert_equal('alive', ch_evalexpr(ch, #{method: 'ping'}).result)
+ 
" Test for invoking an unsupported method
let resp = ch_evalexpr(ch, #{method: 'xyz', params: {}}, #{timeout: 200})
call assert_equal({}, resp)
*** ../vim-8.2.4787/src/testdir/test_channel_lsp.py 2022-04-18 
14:07:42.538262252 +0100
--- src/testdir/test_channel_lsp.py 2022-04-19 10:21:27.853706364 +0100
***
*** 24,29 
--- 24,34 
  def setup(self):
  self.request.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
  
+ def debuglog(self, msg):
+ if self.debug:
+ with open("Xlspserver.log", "a") as myfile:
+ myfile.write(msg)
+ 
  def send_lsp_msg(self, msgid, resp_dict):
  v = {'jsonrpc': '2.0', 'result': resp_dict}
  if msgid != -1:
***
*** 34,41 
  resp += "\r\n"
  resp += s
  if self.debug:
! with open("Xlspdebug.log", "a") as myfile:
! myfile.write("\n=> send\n" + resp)
  self.request.sendall(resp.encode('utf-8'))
  
  def send_wrong_payload(self):
--- 39,45 
  resp += "\r\n"
  resp += s
  if self.debug:
! self.debuglog("SEND: ({0} bytes) '{1}'\n".format(len(resp), resp))
  self.request.sendall(resp.encode('utf-8'))
  
  def send_wrong_payload(self):
***
*** 136,141 
--- 140,149 
  time.sleep(0.2)
  self.send_lsp_msg(-1, 'wrong-payload')
  
+ def do_large_payload(self, payload):
+ # test for sending a large (> 64K) payload
+ self.send_lsp_msg(payload['id'], payload)
+ 
  def do_rpc_resp_incorrect_id(self, payload):
  self.send_lsp_msg(-1, 'rpc-resp-incorrect-id-1')
  self.send_lsp_msg(-1, 'rpc-resp-incorrect-id-2')
***
*** 185,192 
  def process_msg(self, msg):
  try:
  decoded = json.loads(msg)
- print("Decoded:")
- print(str(decoded))
  if 'method' in decoded:
  test_map = {
  'ping': self.do_ping,
--- 193,198 
***
*** 194,199 
--- 200,206 
  'simple-rpc': self.do_simple_rpc,
  'rpc-with-notif': self.do_rpc_with_notif,
  'wrong-payload': self.do_wrong_payload,
+ 'large-payload': self.do_large_payload,
  'rpc-resp-incorrect-id': 
self.do_rpc_resp_incorrect_id,
  'simple-notif': self.do_simple_notif,
  'multi-notif': self.do_multi_notif,
***
*** 211,238 
  if decoded['method'] in test_map:
  test_map[decoded['method']](decoded)