diff options
author | Christopher Plewright <chris@createng.com> | 2022-11-23 22:28:08 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-23 22:28:08 +0000 |
commit | 36446bbb62b466ce873c872b266a29bebbfc9890 (patch) | |
tree | 456dfaa075f21860ee5e07917a6a643d91e3261e | |
parent | 63a2e360cca2c70ab0a85d14771d3259d4b3aafa (diff) | |
download | vim-git-36446bbb62b466ce873c872b266a29bebbfc9890.tar.gz |
patch 9.0.0931: MS-Windows: mouse column limited to 223v9.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)
-rw-r--r-- | src/mouse.c | 11 | ||||
-rw-r--r-- | src/os_win32.c | 14 | ||||
-rw-r--r-- | src/term.c | 11 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 27 insertions, 11 deletions
diff --git a/src/mouse.c b/src/mouse.c index b83523a26..954b2134d 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -2308,10 +2308,15 @@ check_termcode_mouse( */ for (;;) { -# ifdef FEAT_GUI - if (gui.in_use) + // 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 + ) { - // 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; diff --git a/src/os_win32.c b/src/os_win32.c index ead50e186..4c97b3100 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2055,17 +2055,23 @@ mch_inchar( 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; } + + // 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 { diff --git a/src/term.c b/src/term.c index 7f639dd57..981e2169c 100644 --- a/src/term.c +++ b/src/term.c @@ -5857,12 +5857,15 @@ check_termcode( // We only get here when we have a complete termcode match -#ifdef FEAT_GUI +#if defined(FEAT_GUI) || defined(MSWIN) /* - * Only in the GUI: Fetch the pointer coordinates of the scroll event - * so that we know which window to scroll later. + * For scroll events from the GUI or MS-Windows console, fetch the + * pointer coordinates so that we know which window to scroll later. */ - if (gui.in_use + 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 diff --git a/src/version.c b/src/version.c index a96b11ada..983955310 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 931, +/**/ 930, /**/ 929, |