Skip to content

Commit

Permalink
Windows: don't enable quick edit mode if it's not already enabled at …
Browse files Browse the repository at this point in the history
…startup.
  • Loading branch information
gwsw committed Oct 2, 2023
1 parent 308cd52 commit 3a4c4c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ static int sy_bg_color;
public int sgr_mode; /* Honor ANSI sequences rather than using above */
#if MSDOS_COMPILER==WIN32C
static DWORD init_console_output_mode;
extern DWORD init_console_input_mode;
extern DWORD curr_console_input_mode;
public int vt_enabled = -1; /* Is virtual terminal processing available? */
#endif
Expand Down Expand Up @@ -1698,7 +1699,7 @@ public void init_mouse(void)
ltputs(sc_s_mousecap, sc_height, putchr);
#else
#if MSDOS_COMPILER==WIN32C
curr_console_input_mode = (curr_console_input_mode | ENABLE_MOUSE_INPUT) & ~ENABLE_QUICK_EDIT_MODE;
curr_console_input_mode = (curr_console_input_mode | ENABLE_MOUSE_INPUT) & ~(ENABLE_QUICK_EDIT_MODE & init_console_input_mode);
SetConsoleMode(tty, curr_console_input_mode);
#endif
#endif
Expand All @@ -1714,7 +1715,7 @@ public void deinit_mouse(void)
ltputs(sc_e_mousecap, sc_height, putchr);
#else
#if MSDOS_COMPILER==WIN32C
curr_console_input_mode = (curr_console_input_mode | ENABLE_QUICK_EDIT_MODE) & ~ENABLE_MOUSE_INPUT;
curr_console_input_mode = (curr_console_input_mode & ~ENABLE_MOUSE_INPUT) | (ENABLE_QUICK_EDIT_MODE & init_console_input_mode);
SetConsoleMode(tty, curr_console_input_mode);
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion ttyin.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#endif
#include <windows.h>
public HANDLE tty;
static DWORD init_console_input_mode;
public DWORD init_console_input_mode;
public DWORD curr_console_input_mode;
#else
public int tty;
Expand Down

0 comments on commit 3a4c4c9

Please sign in to comment.