mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1335: CTRL-C in the GUI doesn't interrupt
Problem: CTRL-C in the GUI doesn't interrupt. (Sergey Vlasov) Solution: Recognize "C" with CTRL modifier as CTRL-C. (issue #6565)
This commit is contained in:
21
src/gui.c
21
src/gui.c
@@ -5575,3 +5575,24 @@ gui_handle_drop(
|
|||||||
entered = FALSE;
|
entered = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if "key" is to interrupt us. Handles a key that has not had modifiers
|
||||||
|
* applied yet.
|
||||||
|
* Return the key with modifiers applied if so, NUL if not.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
check_for_interrupt(int key, int modifiers_arg)
|
||||||
|
{
|
||||||
|
int modifiers = modifiers_arg;
|
||||||
|
int c = merge_modifyOtherKeys(key, &modifiers);
|
||||||
|
|
||||||
|
if ((c == Ctrl_C && ctrl_c_interrupts)
|
||||||
|
|| (intr_char != Ctrl_C && c == intr_char))
|
||||||
|
{
|
||||||
|
got_int = TRUE;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return NUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1254,11 +1254,16 @@ key_press_event(GtkWidget *widget UNUSED,
|
|||||||
add_to_input_buf(string2, 3);
|
add_to_input_buf(string2, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
|
// Check if the key interrupts.
|
||||||
|| (string[0] == intr_char && intr_char != Ctrl_C)))
|
|
||||||
{
|
{
|
||||||
trash_input_buf();
|
int int_ch = check_for_interrupt(key, modifiers);
|
||||||
got_int = TRUE;
|
|
||||||
|
if (int_ch != NUL)
|
||||||
|
{
|
||||||
|
trash_input_buf();
|
||||||
|
string[0] = int_ch;
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_to_input_buf(string, len);
|
add_to_input_buf(string, len);
|
||||||
|
@@ -596,11 +596,17 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
|
|||||||
string[ len++ ] = ch;
|
string[ len++ ] = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 1 && ((ch == Ctrl_C && ctrl_c_interrupts)
|
// Check if the key interrupts.
|
||||||
|| ch == intr_char))
|
|
||||||
{
|
{
|
||||||
trash_input_buf();
|
int int_ch = check_for_interrupt(ch, modifiers);
|
||||||
got_int = TRUE;
|
|
||||||
|
if (int_ch != NUL)
|
||||||
|
{
|
||||||
|
ch = int_ch;
|
||||||
|
string[0] = ch;
|
||||||
|
len = 1;
|
||||||
|
trash_input_buf();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 1 && string[0] == CSI)
|
if (len == 1 && string[0] == CSI)
|
||||||
|
@@ -970,14 +970,16 @@ gui_x11_key_hit_cb(
|
|||||||
add_to_input_buf(string2, 3);
|
add_to_input_buf(string2, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
|
// Check if the key interrupts.
|
||||||
#ifdef UNIX
|
|
||||||
|| (intr_char != 0 && string[0] == intr_char)
|
|
||||||
#endif
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
trash_input_buf();
|
int int_ch = check_for_interrupt(key, modifiers);
|
||||||
got_int = TRUE;
|
|
||||||
|
if (int_ch != NUL)
|
||||||
|
{
|
||||||
|
trash_input_buf();
|
||||||
|
string[0] = int_ch;
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_to_input_buf(string, len);
|
add_to_input_buf(string, len);
|
||||||
|
@@ -65,4 +65,5 @@ void gui_update_screen(void);
|
|||||||
char_u *get_find_dialog_text(char_u *arg, int *wwordp, int *mcasep);
|
char_u *get_find_dialog_text(char_u *arg, int *wwordp, int *mcasep);
|
||||||
int gui_do_findrepl(int flags, char_u *find_text, char_u *repl_text, int down);
|
int gui_do_findrepl(int flags, char_u *find_text, char_u *repl_text, int down);
|
||||||
void gui_handle_drop(int x, int y, int_u modifiers, char_u **fnames, int count);
|
void gui_handle_drop(int x, int y, int_u modifiers, char_u **fnames, int count);
|
||||||
|
int check_for_interrupt(int key, int modifiers_arg);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1335,
|
||||||
/**/
|
/**/
|
||||||
1334,
|
1334,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user