Skip to content

Commit 157d813

Browse files
committed
patch 8.0.1582: in the MS-Windows console mouse movement is not used
Problem: In the MS-Windows console mouse movement is not used. Solution: Pass mouse movement events when useful.
1 parent 3b3a9a5 commit 157d813

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

src/feature.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@
13181318
/*
13191319
* +balloon_eval_term Allow balloon expression evaluation in the terminal.
13201320
*/
1321-
#if defined(FEAT_HUGE) && defined(UNIX) && defined(FEAT_TIMERS)
1321+
#if defined(FEAT_HUGE) && (defined(UNIX) || defined(WIN32)) && defined(FEAT_TIMERS)
13221322
# define FEAT_BEVAL_TERM
13231323
#endif
13241324

src/os_win32.c

+24-3
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,18 @@ mch_setmouse(int on)
11641164
SetConsoleMode(g_hConIn, cmodein);
11651165
}
11661166

1167+
1168+
#if defined(FEAT_BEVAL_TERM) || defined(PROTO)
1169+
/*
1170+
* Called when 'balloonevalterm' changed.
1171+
*/
1172+
void
1173+
mch_bevalterm_changed(void)
1174+
{
1175+
mch_setmouse(g_fMouseActive);
1176+
}
1177+
#endif
1178+
11671179
/*
11681180
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
11691181
* MOUSE_MIDDLE, or MOUSE_RIGHT for a click; MOUSE_DRAG for a mouse
@@ -1243,7 +1255,7 @@ decode_mouse_event(
12431255

12441256
if (pmer->dwEventFlags == MOUSE_MOVED)
12451257
{
1246-
/* ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these
1258+
/* Ignore MOUSE_MOVED events if (x, y) hasn't changed. (We get these
12471259
* events even when the mouse moves only within a char cell.) */
12481260
if (s_xOldMouse == g_xMouse && s_yOldMouse == g_yMouse)
12491261
return FALSE;
@@ -1252,11 +1264,20 @@ decode_mouse_event(
12521264
/* If no buttons are pressed... */
12531265
if ((pmer->dwButtonState & ((1 << cButtons) - 1)) == 0)
12541266
{
1267+
nButton = MOUSE_RELEASE;
1268+
12551269
/* If the last thing returned was MOUSE_RELEASE, ignore this */
12561270
if (s_fReleased)
1257-
return FALSE;
1271+
{
1272+
#ifdef FEAT_BEVAL_TERM
1273+
/* do return mouse move events when we want them */
1274+
if (p_bevalterm)
1275+
nButton = MOUSE_DRAG;
1276+
else
1277+
#endif
1278+
return FALSE;
1279+
}
12581280

1259-
nButton = MOUSE_RELEASE;
12601281
s_fReleased = TRUE;
12611282
}
12621283
else /* one or more buttons pressed */

src/proto/os_win32.pro

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ int dyn_libintl_init(void);
66
void dyn_libintl_end(void);
77
void PlatformId(void);
88
void mch_setmouse(int on);
9+
void mch_bevalterm_changed(void);
910
void mch_update_cursor(void);
1011
int mch_char_avail(void);
1112
int mch_check_messages(void);

src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,8 @@ static char *(features[]) =
766766

767767
static int included_patches[] =
768768
{ /* Add new patch number below this line */
769+
/**/
770+
1582,
769771
/**/
770772
1581,
771773
/**/

0 commit comments

Comments
 (0)