To: vim_dev@googlegroups.com Subject: Patch 8.2.1335 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1335 Problem: CTRL-C in the GUI doesn't interrupt. (Sergey Vlasov) Solution: Recognize "C" with CTRL modifier as CTRL-C. (issue #6565) Files: src/gui.c, src/proto/gui.pro, src/gui_gtk_x11.c, src/gui_x11.c, src/gui_photon.c *** ../vim-8.2.1334/src/gui.c 2020-07-17 20:43:37.284617059 +0200 --- src/gui.c 2020-08-01 13:07:22.854979936 +0200 *************** *** 5575,5577 **** --- 5575,5598 ---- 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; + } + *** ../vim-8.2.1334/src/proto/gui.pro 2020-03-28 20:44:37.554078887 +0100 --- src/proto/gui.pro 2020-08-01 13:01:55.575871387 +0200 *************** *** 65,68 **** --- 65,69 ---- 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 : */ *** ../vim-8.2.1334/src/gui_gtk_x11.c 2020-06-21 15:09:10.665865729 +0200 --- src/gui_gtk_x11.c 2020-08-01 12:52:44.753371597 +0200 *************** *** 1254,1264 **** add_to_input_buf(string2, 3); } ! if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts) ! || (string[0] == intr_char && intr_char != Ctrl_C))) { ! trash_input_buf(); ! got_int = TRUE; } add_to_input_buf(string, len); --- 1254,1269 ---- add_to_input_buf(string2, 3); } ! // Check if the key interrupts. { ! 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); *** ../vim-8.2.1334/src/gui_x11.c 2020-06-21 15:09:10.665865729 +0200 --- src/gui_x11.c 2020-08-01 12:51:45.249533667 +0200 *************** *** 970,983 **** 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 ! )) { ! trash_input_buf(); ! got_int = TRUE; } add_to_input_buf(string, len); --- 970,985 ---- add_to_input_buf(string2, 3); } ! // Check if the key interrupts. { ! 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); *** ../vim-8.2.1334/src/gui_photon.c 2020-07-17 20:43:37.288617050 +0200 --- src/gui_photon.c 2020-08-01 12:52:33.293402812 +0200 *************** *** 596,606 **** string[ len++ ] = ch; } ! if (len == 1 && ((ch == Ctrl_C && ctrl_c_interrupts) ! || ch == intr_char)) { ! trash_input_buf(); ! got_int = TRUE; } if (len == 1 && string[0] == CSI) --- 596,612 ---- string[ len++ ] = ch; } ! // Check if the key interrupts. { ! 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) *** ../vim-8.2.1334/src/version.c 2020-08-01 12:25:59.857732161 +0200 --- src/version.c 2020-08-01 13:07:34.510948186 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1335, /**/ -- # echo reboot >universe # chmod +x universe # ./universe /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///