vim 9 dictionary keys cannot be dictionaries, lists, funcrefs or objects

2023-01-10 Fir de Conversatie Mark Baily
Just wondering is there is a chance that a future version of vim will allow 
dictionary keys to be not just strings but dictionaries, lists, funcrefs or 
other objects?

Other languages do allow this, such as Emacs Lisp, Python, Javascript, Lua, 
C (like GLib).

Thanks
Mark

-- 
-- 
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/3fe57dbb-1455-4292-a826-57505ada0a55n%40googlegroups.com.


Patch 9.0.1174

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1174
Problem:Smali files are not recognized.
Solution:   Add a pattern for Smali files. (Amaan Qureshi, closes #11801)
Files:  runtime/filetype.vim, src/testdir/test_filetype.vim


*** ../vim-9.0.1173/runtime/filetype.vim2023-01-09 20:07:56.713533250 
+
--- runtime/filetype.vim2023-01-10 19:55:17.679036547 +
***
*** 1897,1902 
--- 1897,1905 
  au BufNewFile,BufRead .slrnrc setf slrnrc
  au BufNewFile,BufRead *.score setf slrnsc
  
+ " Smali
+ au BufNewFile,BufRead *.smali setf smali
+ 
  " Smalltalk
  au BufNewFile,BufRead *.stsetf st
  
*** ../vim-9.0.1173/src/testdir/test_filetype.vim   2023-01-09 
20:07:56.713533250 +
--- src/testdir/test_filetype.vim   2023-01-10 19:57:10.470527947 +
***
*** 524,529 
--- 524,530 
  \ 'slrnrc': ['.slrnrc'],
  \ 'slrnsc': ['file.score'],
  \ 'sm': ['sendmail.cf'],
+ \ 'smali': ['file.smali'],
  \ 'smarty': ['file.tpl'],
  \ 'smcl': ['file.hlp', 'file.ihlp', 'file.smcl'],
  \ 'smith': ['file.smt', 'file.smith'],
*** ../vim-9.0.1173/src/version.c   2023-01-10 19:17:08.078354902 +
--- src/version.c   2023-01-10 19:56:28.246709133 +
***
*** 697,698 
--- 697,700 
  {   /* Add new patch number below this line */
+ /**/
+ 1174,
  /**/

-- 
Sometimes you can protect millions of dollars in your budget simply by buying
a bag of cookies, dropping it on the budget anylyst's desk, and saying
something deeply personal such as "How was your weekend, big guy?"
(Scott Adams - The Dilbert principle)

 /// 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/20230110195913.913A51C0494%40moolenaar.net.


Re: Patch 9.0.1168

2023-01-10 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 10-Jan-2023 23:38, Bram Moolenaar wrote:
> > Patch 9.0.1168
> > Problem:Code to enable/disable mouse is not from terminfo/termcap.
> > Solution:   Request the "XM" entry and use it to set 'ttymouse' if possible.
> > Files:  runtime/doc/options.txt, src/term.c, src/proto/term.pro,
> >  src/termdefs.h, src/os_unix.c, src/optiondefs.h
> >
> >
> >
> After this patch msys64 (clang 15.0.5) gives this warning:
> 
> 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 -DFEAT_GUI_MSWIN 
> -DFEAT_CLIPBOARD term.c -o gobjx86-64/term.o
> term.c:2164:9: warning: variable 'did_set_ttym' set but not used 
> [-Wunused-but-set-variable]
>      int did_set_ttym = FALSE;
>      ^
> 1 warning generated.
> 
> 
> The attached patch tries to fix it.

I'll include it, thanks.

-- 
I recommend ordering large cargo containers of paper towels to make up
whatever budget underruns you have.  Paper products are always useful and they
have the advantage of being completely flushable if you need to make room in
the storage area later.
(Scott Adams - The Dilbert principle)

 /// 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/20230110191750.B2A3E1C0494%40moolenaar.net.


Patch 9.0.1173

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1173
Problem:Compiler warning for unused variable on non-Unix systems.
Solution:   Move #ifdef. (John Marriott)
Files:  src/term.c


*** ../vim-9.0.1172/src/term.c  2023-01-10 12:37:33.249580669 +
--- src/term.c  2023-01-10 19:14:48.638242268 +
***
*** 2159,2164 
--- 2159,2165 
  init_term_props(FALSE);
  #endif
  
+ #if defined(UNIX) || defined(VMS)
  // If the first number in t_XM is 1006 then the terminal will support SGR
  // mouse reporting.
  int did_set_ttym = FALSE;
***
*** 2175,2181 
}
  }
  
- #if defined(UNIX) || defined(VMS)
  /*
   * For Unix, set the 'ttymouse' option to the type of mouse to be used.
   * The termcode for the mouse is added as a side effect in option.c.
--- 2176,2181 
*** ../vim-9.0.1172/src/version.c   2023-01-10 17:29:24.916481478 +
--- src/version.c   2023-01-10 19:15:37.606286190 +
***
*** 697,698 
--- 697,700 
  {   /* Add new patch number below this line */
+ /**/
+ 1173,
  /**/

-- 
If the Universe is constantly expanding, why can't I ever find a parking space?

 /// 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/20230110191750.B4BB01C0491%40moolenaar.net.


Re: Patch 9.0.1168

2023-01-10 Fir de Conversatie John Marriott


On 10-Jan-2023 23:38, Bram Moolenaar wrote:

Patch 9.0.1168
Problem:Code to enable/disable mouse is not from terminfo/termcap.
Solution:   Request the "XM" entry and use it to set 'ttymouse' if possible.
Files:  runtime/doc/options.txt, src/term.c, src/proto/term.pro,
 src/termdefs.h, src/os_unix.c, src/optiondefs.h




After this patch msys64 (clang 15.0.5) gives this warning:

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 -DFEAT_GUI_MSWIN 
-DFEAT_CLIPBOARD term.c -o gobjx86-64/term.o
term.c:2164:9: warning: variable 'did_set_ttym' set but not used 
[-Wunused-but-set-variable]

    int did_set_ttym = FALSE;
    ^
1 warning generated.


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/8f0f4f93-f4a4-2d0b-74fc-825b2407cac4%40internode.on.net.
--- term.c.orig 2023-01-11 05:41:51.601366200 +1100
+++ term.c  2023-01-11 05:50:51.350287200 +1100
@@ -2159,6 +2159,7 @@
 init_term_props(FALSE);
 #endif
 
+#if defined(UNIX) || defined(VMS)
 // If the first number in t_XM is 1006 then the terminal will support SGR
 // mouse reporting.
 int did_set_ttym = FALSE;
@@ -2175,7 +2176,6 @@
}
 }
 
-#if defined(UNIX) || defined(VMS)
 /*
  * For Unix, set the 'ttymouse' option to the type of mouse to be used.
  * The termcode for the mouse is added as a side effect in option.c.


Patch 9.0.1172

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1172
Problem:When 'selection' is "exclusive" then "1v" is one char short.
Solution:   Add one character when 'selection' is "exclusive. (closes #11791)
Files:  src/normal.c, src/testdir/test_visual.vim


*** ../vim-9.0.1171/src/normal.c2023-01-01 18:03:55.476613184 +
--- src/normal.c2023-01-10 17:27:53.132527097 +
***
*** 5472,5478 
if (resel_VIsual_line_count <= 1)
{
update_curswant_force();
!   curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1;
}
else
curwin->w_curswant = resel_VIsual_vcol;
--- 5472,5480 
if (resel_VIsual_line_count <= 1)
{
update_curswant_force();
!   curwin->w_curswant += resel_VIsual_vcol * cap->count0;
!   if (*p_sel != 'e')
!   --curwin->w_curswant;
}
else
curwin->w_curswant = resel_VIsual_vcol;
*** ../vim-9.0.1171/src/testdir/test_visual.vim 2022-11-02 13:30:37.546314580 
+
--- src/testdir/test_visual.vim 2023-01-10 17:27:44.324531504 +
***
*** 1336,1341 
--- 1336,1353 
bwipe!
  endfunc
  
+ func Test_visual_reselect_exclusive()
+   new
+   call setline(1, ['abcde', 'abcde'])
+   set selection=exclusive
+   normal 1G0viwd
+   normal 2G01vd
+   call assert_equal(['', ''], getline(1, 2))
+ 
+   set selection&
+   bwipe!
+ endfunc
+ 
  func Test_visual_block_insert_round_off()
new
" The number of characters are tuned to fill a 4096 byte allocated block,
*** ../vim-9.0.1171/src/version.c   2023-01-10 16:02:41.248313354 +
--- src/version.c   2023-01-10 17:19:46.340785053 +
***
*** 697,698 
--- 697,700 
  {   /* Add new patch number below this line */
+ /**/
+ 1172,
  /**/

-- 
The only way the average employee can speak to an executive is by taking a
second job as a golf caddie.
(Scott Adams - The Dilbert principle)

 /// 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/20230110173021.868DF1C0498%40moolenaar.net.


Patch 9.0.1171

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1171
Problem:Screen is not redrawn after using setcellwidths().
Solution:   Redraw the screen when the cell widths have changed. (Yasuhiro
Matsumoto, closes #11800)
Files:  src/mbyte.c, src/testdir/test_utf8.vim,
src/testdir/dumps/Test_setcellwidths_dump_1.dump,
src/testdir/dumps/Test_setcellwidths_dump_2.dump


*** ../vim-9.0.1170/src/mbyte.c 2022-11-07 11:05:47.617214227 +
--- src/mbyte.c 2023-01-10 16:01:43.056410200 +
***
*** 5742,5747 
--- 5742,5748 
  }
  
  vim_free(cw_table_save);
+ redraw_all_later(UPD_CLEAR);
  }
  
  void
*** ../vim-9.0.1170/src/testdir/test_utf8.vim   2022-09-01 12:22:19.751659183 
+0100
--- src/testdir/test_utf8.vim   2023-01-10 15:59:45.716618656 +
***
*** 2,7 
--- 2,8 
   
  source check.vim
  source view_util.vim
+ source screendump.vim
  
  " Visual block Insert adjusts for multi-byte char
  func Test_visual_block_insert()
***
*** 198,203 
--- 199,220 
call setcellwidths([])
  endfunc
  
+ func Test_setcellwidths_dump()
+   CheckRunVimInTerminal
+ 
+   let lines =<< trim END
+   call setline(1, "\ue5ffDesktop")
+   END
+   call writefile(lines, 'XCellwidths', 'D')
+   let buf = RunVimInTerminal('-S XCellwidths', {'rows': 6})
+   call VerifyScreenDump(buf, 'Test_setcellwidths_dump_1', {})
+ 
+   call term_sendkeys(buf, ":call setcellwidths([[0xe5ff, 0xe5ff, 2]])\")
+   call VerifyScreenDump(buf, 'Test_setcellwidths_dump_2', {})
+ 
+   call StopVimInTerminal(buf)
+ endfunc
+ 
  func Test_print_overlong()
" Text with more composing characters than MB_MAXBYTES.
new
*** ../vim-9.0.1170/src/testdir/dumps/Test_setcellwidths_dump_1.dump
2023-01-10 16:02:06.640370473 +
--- src/testdir/dumps/Test_setcellwidths_dump_1.dump2023-01-10 
16:00:08.412576808 +
***
*** 0 
--- 1,6 
+ 

Patch 9.0.1170

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1170
Problem:LGTM badge no longer works.
Solution:   Remove the LGTM badge. (closes #11799)
Files:  README.md


*** ../vim-9.0.1169/README.md   2022-09-18 12:24:30.542430902 +0100
--- README.md   2023-01-10 14:02:24.874623586 +
***
*** 1,6 
  [![Vim 
Logo](https://github.com/vim/vim/raw/master/runtime/vimlogo.gif)](https://www.vim.org)
  
! [![Github Build 
status](https://github.com/vim/vim/workflows/GitHub%20CI/badge.svg)](https://github.com/vim/vim/actions?query=workflow%3A%22GitHub+CI%22)
 [![Appveyor Build 
status](https://ci.appveyor.com/api/projects/status/o2qht2kjm02sgghk?svg=true)](https://ci.appveyor.com/project/chrisbra/vim)
 [![Cirrus Build 
Status](https://api.cirrus-ci.com/github/vim/vim.svg)](https://cirrus-ci.com/github/vim/vim)
 [![Coverage 
Status](https://codecov.io/gh/vim/vim/coverage.svg?branch=master)](https://codecov.io/gh/vim/vim?branch=master)
 [![Coverity 
Scan](https://scan.coverity.com/projects/241/badge.svg)](https://scan.coverity.com/projects/vim)
 [![Language Grade: 
C/C++](https://img.shields.io/lgtm/grade/cpp/g/vim/vim.svg?logo=lgtm=18)](https://lgtm.com/projects/g/vim/vim/context:cpp)
 [![Debian 
CI](https://badges.debian.net/badges/debian/testing/vim/version.svg)](https://buildd.debian.org/vim)
 
[![Packages](https://repology.org/badge/tiny-repos/vim.svg)](https://repology.org/metapackage
 /vim) [![Fossies codespell 
report](https://fossies.org/linux/test/vim-master.tar.gz/codespell.svg)](https://fossies.org/linux/test/vim-master.tar.gz/codespell.html)
  
  For translations of this README see the end.
  
--- 1,6 
  [![Vim 
Logo](https://github.com/vim/vim/raw/master/runtime/vimlogo.gif)](https://www.vim.org)
  
! [![Github Build 
status](https://github.com/vim/vim/workflows/GitHub%20CI/badge.svg)](https://github.com/vim/vim/actions?query=workflow%3A%22GitHub+CI%22)
 [![Appveyor Build 
status](https://ci.appveyor.com/api/projects/status/o2qht2kjm02sgghk?svg=true)](https://ci.appveyor.com/project/chrisbra/vim)
 [![Cirrus Build 
Status](https://api.cirrus-ci.com/github/vim/vim.svg)](https://cirrus-ci.com/github/vim/vim)
 [![Coverage 
Status](https://codecov.io/gh/vim/vim/coverage.svg?branch=master)](https://codecov.io/gh/vim/vim?branch=master)
 [![Coverity 
Scan](https://scan.coverity.com/projects/241/badge.svg)](https://scan.coverity.com/projects/vim)
 [![Debian 
CI](https://badges.debian.net/badges/debian/testing/vim/version.svg)](https://buildd.debian.org/vim)
 
[![Packages](https://repology.org/badge/tiny-repos/vim.svg)](https://repology.org/metapackage/vim)
 [![Fossies codespell 
report](https://fossies.org/linux/test/vim-master.tar.gz/codespell.svg)](https://fossies.org/linux/test/vim-master.tar.gz/cod
 espell.html)
  
  For translations of this README see the end.
  
***
*** 101,107 
  
  Summary of the license: There are no restrictions on using or distributing an
  unmodified copy of Vim.  Parts of Vim may also be distributed, but the license
! text must always be included.  For modified versions a few restrictions apply.
  The license is GPL compatible, you may compile Vim with GPL libraries and
  distribute it.
  
--- 101,107 
  
  Summary of the license: There are no restrictions on using or distributing an
  unmodified copy of Vim.  Parts of Vim may also be distributed, but the license
! text must always be included.  For modified versions, a few restrictions 
apply.
  The license is GPL compatible, you may compile Vim with GPL libraries and
  distribute it.
  
***
*** 122,128 
  
  ## Contributing ##
  
! If you would like to help making Vim better, see the
  [CONTRIBUTING.md](/CONTRIBUTING.md) file.
  
  
--- 122,128 
  
  ## Contributing ##
  
! If you would like to help make Vim better, see the
  [CONTRIBUTING.md](/CONTRIBUTING.md) file.
  
  
*** ../vim-9.0.1169/src/version.c   2023-01-10 13:42:59.722128350 +
--- src/version.c   2023-01-10 14:03:55.054616018 +
***
*** 697,698 
--- 697,700 
  {   /* Add new patch number below this line */
+ /**/
+ 1170,
  /**/

-- 
An easy way to determine if you have enough teamwork to be doomed is simply to
measure how long it takes from the time you decide to go to lunch together
until the time you actually eat.
(Scott Adams - The Dilbert principle)

 /// 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 

Patch 9.0.1169

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1169
Problem:Some key+modifier tests fail on some AppVeyor images.
Solution:   Adjust the tests for key movements and fix the revealed bugs.
(Christopher Plewright, closes #11798)
Files:  src/os_win32.c, src/testdir/test_gui.vim,
src/testdir/test_mswin_event.vim


*** ../vim-9.0.1168/src/os_win32.c  2023-01-04 18:05:55.408803650 +
--- src/os_win32.c  2023-01-10 13:41:03.137935193 +
***
*** 1043,1049 
  }
  
  // check if it already has a valid unicode character.
! if (pker->uChar.UnicodeChar > 0 && pker->uChar.UnicodeChar < 0xFFFD)
return 1;
  
  CLEAR_FIELD(abKeystate);
--- 1043,1049 
  }
  
  // check if it already has a valid unicode character.
! if (pker->uChar.UnicodeChar != 0)
return 1;
  
  CLEAR_FIELD(abKeystate);
***
*** 1154,1165 
else if (pker->wVirtualKeyCode >= VK_END
&& pker->wVirtualKeyCode <= VK_DOWN)
{
!   // VK_END   0x23
!   // VK_HOME  0x24
!   // VK_LEFT  0x25
!   // VK_UP0x26
!   // VK_RIGHT 0x27
!   // VK_DOWN  0x28
*pmodifiers = 0;
*pch2 = VirtKeyMap[i].chAlone;
if ((nModifs & SHIFT) != 0
--- 1154,1162 
else if (pker->wVirtualKeyCode >= VK_END
&& pker->wVirtualKeyCode <= VK_DOWN)
{
!   // (0x23 - 0x28): VK_END, VK_HOME,
!   // VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN
! 
*pmodifiers = 0;
*pch2 = VirtKeyMap[i].chAlone;
if ((nModifs & SHIFT) != 0
***
*** 1167,1173 
{
*pch2 = VirtKeyMap[i].chShift;
}
!   else if ((nModifs & CTRL) != 0
 && (nModifs & ~CTRL) == 0)
{
*pch2 = VirtKeyMap[i].chCtrl;
--- 1164,1170 
{
*pch2 = VirtKeyMap[i].chShift;
}
!   if ((nModifs & CTRL) != 0
 && (nModifs & ~CTRL) == 0)
{
*pch2 = VirtKeyMap[i].chCtrl;
***
*** 1178,1194 
*pch2 = VirtKeyMap[i].chAlone;
}
}
!   else if ((nModifs & ALT) != 0
! && (nModifs & ~ALT) == 0)
!   {
!   *pch2 = VirtKeyMap[i].chAlt;
!   }
!   else if ((nModifs & SHIFT) != 0
  && (nModifs & CTRL) != 0)
{
*pmodifiers |= MOD_MASK_CTRL;
*pch2 = VirtKeyMap[i].chShift;
}
}
else
{
--- 1175,1212 
*pch2 = VirtKeyMap[i].chAlone;
}
}
!   if ((nModifs & SHIFT) != 0
  && (nModifs & CTRL) != 0)
{
*pmodifiers |= MOD_MASK_CTRL;
*pch2 = VirtKeyMap[i].chShift;
}
+   if ((nModifs & ALT) != 0)
+   {
+   *pch2 = VirtKeyMap[i].chAlt;
+   *pmodifiers |= MOD_MASK_ALT;
+   if ((nModifs & ~ALT) == 0)
+   {
+   *pch2 = VirtKeyMap[i].chAlone;
+   }
+   else if ((nModifs & SHIFT) != 0)
+   {
+   *pch2 = VirtKeyMap[i].chShift;
+   }
+   else if ((nModifs & CTRL) != 0)
+   {
+   if (pker->wVirtualKeyCode == VK_UP
+   || pker->wVirtualKeyCode == VK_DOWN)
+   {
+   *pmodifiers |= MOD_MASK_CTRL;
+ 

Patch 9.0.1168

2023-01-10 Fir de Conversatie Bram Moolenaar


Patch 9.0.1168
Problem:Code to enable/disable mouse is not from terminfo/termcap.
Solution:   Request the "XM" entry and use it to set 'ttymouse' if possible.
Files:  runtime/doc/options.txt, src/term.c, src/proto/term.pro,
src/termdefs.h, src/os_unix.c, src/optiondefs.h


*** ../vim-9.0.1167/runtime/doc/options.txt 2022-12-15 13:14:17.407527409 
+
--- runtime/doc/options.txt 2023-01-10 12:30:39.140845488 +
***
*** 8628,8633 
--- 8679,8687 
set to a name that starts with "xterm", "mlterm", "screen", "tmux",
"st" (full match only), "st-" or "stterm", and 'ttymouse' is not set
already.
+   If the terminfo/termcap entry "XM" exists and the first number is
+   "1006" then 'ttymouse' will be set to "sgr".  This works for many
+   modern terminals.
Additionally, if vim is compiled with the |+termresponse| feature and
|t_RV| is set to the escape sequence to request the xterm version
number, more intelligent detection is done.
*** ../vim-9.0.1167/src/term.c  2023-01-01 18:03:55.472613188 +
--- src/term.c  2023-01-09 20:58:41.933966628 +
***
*** 473,478 
--- 473,479 
  {(int)KS_CGP, "\033[13t"},
  #  endif
  {(int)KS_CRV, "\033[>c"},
+ {(int)KS_CXM, "\033[?1006;1000%?%p1%{1}%=%th%el%;"},
  {(int)KS_RFG, "\033]10;?\007"},
  {(int)KS_RBG, "\033]11;?\007"},
  {(int)KS_U7,  "\033[6n"},
***
*** 1229,1234 
--- 1230,1236 
  {(int)KS_CWP, "[%dCWP%d]"},
  #  endif
  {(int)KS_CRV, "[CRV]"},
+ {(int)KS_CXM, "[CXM]"},
  {(int)KS_U7,  "[U7]"},
  {(int)KS_RFG, "[RFG]"},
  {(int)KS_RBG, "[RBG]"},
***
*** 1721,1727 
{KS_BC, "bc"}, {KS_CSB,"Sb"}, {KS_CSF,"Sf"},
{KS_CAB,"AB"}, {KS_CAF,"AF"}, {KS_CAU,"AU"},
{KS_LE, "le"},
!   {KS_ND, "nd"}, {KS_OP, "op"}, {KS_CRV, "RV"},
{KS_VS, "vs"}, {KS_CVS, "VS"},
{KS_CIS, "IS"}, {KS_CIE, "IE"},
{KS_CSC, "SC"}, {KS_CEC, "EC"},
--- 1723,1730 
{KS_BC, "bc"}, {KS_CSB,"Sb"}, {KS_CSF,"Sf"},
{KS_CAB,"AB"}, {KS_CAF,"AF"}, {KS_CAU,"AU"},
{KS_LE, "le"},
!   {KS_ND, "nd"}, {KS_OP, "op"},
!   {KS_CRV, "RV"}, {KS_CXM, "XM"},
{KS_VS, "vs"}, {KS_CVS, "VS"},
{KS_CIS, "IS"}, {KS_CIE, "IE"},
{KS_CSC, "SC"}, {KS_CEC, "EC"},
***
*** 2107,2114 
  else
T_CCS = empty_option;
  
! // Special case: "kitty" does not normally have a "RV" entry in terminfo,
! // but we need to request the version for several other things to work.
  if (strstr((char *)term, "kitty") != NULL
   && (T_CRV == NULL || *T_CRV == NUL))
T_CRV = (char_u *)"\033[>c";
--- 2110,2117 
  else
T_CCS = empty_option;
  
! // Special case: "kitty" may not have a "RV" entry in terminfo, but we 
need
! // to request the version for several other things to work.
  if (strstr((char *)term, "kitty") != NULL
   && (T_CRV == NULL || *T_CRV == NUL))
T_CRV = (char_u *)"\033[>c";
***
*** 2156,2161 
--- 2159,2180 
  init_term_props(FALSE);
  #endif
  
+ // If the first number in t_XM is 1006 then the terminal will support SGR
+ // mouse reporting.
+ int did_set_ttym = FALSE;
+ if (T_CXM != NULL && *T_CXM != NUL && !option_was_set((char_u *)"ttym"))
+ {
+   char_u *p = T_CXM;
+ 
+   while (*p != NUL && !VIM_ISDIGIT(*p))
+   ++p;
+   if (getdigits() == 1006)
+   {
+   did_set_ttym = TRUE;
+   set_option_value_give_err((char_u *)"ttym", 0L, (char_u *)"sgr", 0);
+   }
+ }
+ 
  #if defined(UNIX) || defined(VMS)
  /*
   * For Unix, set the 'ttymouse' option to the type of mouse to be used.
***
*** 2173,2179 
p = (char_u *)"xterm";
}
  # endif
!   if (p != NULL)
{
set_option_value_give_err((char_u *)"ttym", 0L, p, 0);
// Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
--- 2192,2198 
p = (char_u *)"xterm";
}
  # endif
!   if (p != NULL && !did_set_ttym)
{
set_option_value_give_err((char_u *)"ttym", 0L, p, 0);
// Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
***
*** 2801,2808 
  if (out_pos > OUT_SIZE - MAX_ESC_SEQ_LEN)
out_flush();
  
! while (*s)
!   out_char_nf(*s++);
  
  // For testing we write one string at a time.
  if (p_wd)
--- 2820,2827 
  if (out_pos > OUT_SIZE -