summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-01 13:10:14 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-01 13:10:14 +0200
commit4e1d8bd79b87b120bd40afe0eba54a419f8c3aee (patch)
tree607aae6414e535150f3e7f385e5519a6da063c25
parentb53da7918c643ef4de1256c37bc8b92413e6dcec (diff)
downloadvim-git-4e1d8bd79b87b120bd40afe0eba54a419f8c3aee.tar.gz
patch 8.2.1335: CTRL-C in the GUI doesn't interruptv8.2.1335
Problem: CTRL-C in the GUI doesn't interrupt. (Sergey Vlasov) Solution: Recognize "C" with CTRL modifier as CTRL-C. (issue #6565)
-rw-r--r--src/gui.c21
-rw-r--r--src/gui_gtk_x11.c13
-rw-r--r--src/gui_photon.c14
-rw-r--r--src/gui_x11.c16
-rw-r--r--src/proto/gui.pro1
-rw-r--r--src/version.c2
6 files changed, 52 insertions, 15 deletions
diff --git a/src/gui.c b/src/gui.c
index 4981d7331..e4745547d 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -5575,3 +5575,24 @@ gui_handle_drop(
entered = FALSE;
}
#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;
+}
+
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 40de66631..341db3d5a 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -1254,11 +1254,16 @@ key_press_event(GtkWidget *widget UNUSED,
add_to_input_buf(string2, 3);
}
- if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
- || (string[0] == intr_char && intr_char != Ctrl_C)))
+ // Check if the key interrupts.
{
- trash_input_buf();
- got_int = TRUE;
+ int int_ch = check_for_interrupt(key, modifiers);
+
+ if (int_ch != NUL)
+ {
+ trash_input_buf();
+ string[0] = int_ch;
+ len = 1;
+ }
}
add_to_input_buf(string, len);
diff --git a/src/gui_photon.c b/src/gui_photon.c
index cdb5e15fa..12b0a3cde 100644
--- a/src/gui_photon.c
+++ b/src/gui_photon.c
@@ -596,11 +596,17 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
string[ len++ ] = ch;
}
- if (len == 1 && ((ch == Ctrl_C && ctrl_c_interrupts)
- || ch == intr_char))
+ // Check if the key interrupts.
{
- trash_input_buf();
- got_int = TRUE;
+ int int_ch = check_for_interrupt(ch, modifiers);
+
+ if (int_ch != NUL)
+ {
+ ch = int_ch;
+ string[0] = ch;
+ len = 1;
+ trash_input_buf();
+ }
}
if (len == 1 && string[0] == CSI)
diff --git a/src/gui_x11.c b/src/gui_x11.c
index 26d02e773..1402407c2 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -970,14 +970,16 @@ gui_x11_key_hit_cb(
add_to_input_buf(string2, 3);
}
- if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
-#ifdef UNIX
- || (intr_char != 0 && string[0] == intr_char)
-#endif
- ))
+ // Check if the key interrupts.
{
- trash_input_buf();
- got_int = TRUE;
+ int int_ch = check_for_interrupt(key, modifiers);
+
+ if (int_ch != NUL)
+ {
+ trash_input_buf();
+ string[0] = int_ch;
+ len = 1;
+ }
}
add_to_input_buf(string, len);
diff --git a/src/proto/gui.pro b/src/proto/gui.pro
index 51bddf90e..d76242026 100644
--- a/src/proto/gui.pro
+++ b/src/proto/gui.pro
@@ -65,4 +65,5 @@ void gui_update_screen(void);
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);
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 : */
diff --git a/src/version.c b/src/version.c
index f65d0fe6e..931793ec7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1335,
+/**/
1334,
/**/
1333,