Patch 9.0.0931
Problem:    MS-Windows: mouse column limited to 223.
Solution:   Use two bytes for each mouse coordinate.  Add the mouse position
            to scroll events. (Christopher Plewright, closes #11597)
Files:      src/mouse.c, src/os_win32.c, src/term.c


*** ../vim-9.0.0930/src/mouse.c 2022-11-22 12:40:44.066427878 +0000
--- src/mouse.c 2022-11-23 22:23:26.760033230 +0000
***************
*** 2308,2317 ****
         */
        for (;;)
        {
! # ifdef FEAT_GUI
!           if (gui.in_use)
            {
-               // GUI uses more bits for columns > 223
                num_bytes = get_bytes_from_buf(tp + *slen, bytes, 5);
                if (num_bytes == -1)    // not enough coordinates
                    return -1;
--- 2308,2322 ----
         */
        for (;;)
        {
!           // For the GUI and for MS-Windows two bytes each are used for row
!           // and column.  Allows for more than 223 columns.
! # if defined(FEAT_GUI) || defined(MSWIN)
!           if (TRUE
! #  if defined(FEAT_GUI) && !defined(MSWIN)
!               && gui.in_use
! #  endif
!               )
            {
                num_bytes = get_bytes_from_buf(tp + *slen, bytes, 5);
                if (num_bytes == -1)    // not enough coordinates
                    return -1;
*** ../vim-9.0.0930/src/os_win32.c      2022-11-22 12:58:22.754664254 +0000
--- src/os_win32.c      2022-11-23 22:25:09.180033947 +0000
***************
*** 2055,2071 ****
                typeahead[typeaheadlen++] = CSI;
                typeahead[typeaheadlen++] = KS_EXTRA;
                typeahead[typeaheadlen++] = scroll_dir;
-               g_nMouseClick = -1;
            }
            else
            {
                typeahead[typeaheadlen++] = ESC + 128;
                typeahead[typeaheadlen++] = 'M';
                typeahead[typeaheadlen++] = g_nMouseClick;
-               typeahead[typeaheadlen++] = g_xMouse + '!';
-               typeahead[typeaheadlen++] = g_yMouse + '!';
-               g_nMouseClick = -1;
            }
        }
        else
        {
--- 2055,2077 ----
                typeahead[typeaheadlen++] = CSI;
                typeahead[typeaheadlen++] = KS_EXTRA;
                typeahead[typeaheadlen++] = scroll_dir;
            }
            else
            {
                typeahead[typeaheadlen++] = ESC + 128;
                typeahead[typeaheadlen++] = 'M';
                typeahead[typeaheadlen++] = g_nMouseClick;
            }
+ 
+           // Pass the pointer coordinates of the mouse event in 2 bytes,
+           // allowing for > 223 columns.  Both for click and scroll events.
+           // This is the same as what is used for the GUI.
+           typeahead[typeaheadlen++] = (char_u)(g_xMouse / 128 + ' ' + 1);
+           typeahead[typeaheadlen++] = (char_u)(g_xMouse % 128 + ' ' + 1);
+           typeahead[typeaheadlen++] = (char_u)(g_yMouse / 128 + ' ' + 1);
+           typeahead[typeaheadlen++] = (char_u)(g_yMouse % 128 + ' ' + 1);
+ 
+           g_nMouseClick = -1;
        }
        else
        {
*** ../vim-9.0.0930/src/term.c  2022-11-23 20:19:17.129682462 +0000
--- src/term.c  2022-11-23 22:27:08.552029689 +0000
***************
*** 5857,5868 ****
  
        // We only get here when we have a complete termcode match
  
! #ifdef FEAT_GUI
        /*
!        * Only in the GUI: Fetch the pointer coordinates of the scroll event
!        * so that we know which window to scroll later.
         */
!       if (gui.in_use
                && key_name[0] == (int)KS_EXTRA
                && (key_name[1] == (int)KE_X1MOUSE
                    || key_name[1] == (int)KE_X2MOUSE
--- 5857,5871 ----
  
        // We only get here when we have a complete termcode match
  
! #if defined(FEAT_GUI) || defined(MSWIN)
        /*
!        * For scroll events from the GUI or MS-Windows console, fetch the
!        * pointer coordinates so that we know which window to scroll later.
         */
!       if (TRUE
! # if defined(FEAT_GUI) && !defined(MSWIN)
!               && gui.in_use
! # endif
                && key_name[0] == (int)KS_EXTRA
                && (key_name[1] == (int)KE_X1MOUSE
                    || key_name[1] == (int)KE_X2MOUSE
*** ../vim-9.0.0930/src/version.c       2022-11-23 20:19:17.133682464 +0000
--- src/version.c       2022-11-23 22:19:31.176010722 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     931,
  /**/

-- 
I have a watch cat! Just break in and she'll watch.

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221123222835.BD31C1C212A%40moolenaar.net.

Raspunde prin e-mail lui