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.


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