Mercurial > vim
comparison src/edit.c @ 14985:4ebda55537a5 v8.1.0504
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
commit https://github.com/vim/vim/commit/4dbc2627641a6b950c30c31cbf7b7e6c36da1927
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Nov 2 11:59:15 2018 +0100
patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave
Problem: When CTRL-C is mapped it triggers InsertLeave.
Solution: Make CTRL-C behave the same way when typed or used in a mapping.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 02 Nov 2018 12:00:07 +0100 |
parents | 27b9a84395b5 |
children | 3a94f7918980 |
comparison
equal
deleted
inserted
replaced
14984:28fde4aa8534 | 14985:4ebda55537a5 |
---|---|
1046 if (ins_at_eol && gchar_cursor() == NUL) | 1046 if (ins_at_eol && gchar_cursor() == NUL) |
1047 o_lnum = curwin->w_cursor.lnum; | 1047 o_lnum = curwin->w_cursor.lnum; |
1048 | 1048 |
1049 if (ins_esc(&count, cmdchar, nomove)) | 1049 if (ins_esc(&count, cmdchar, nomove)) |
1050 { | 1050 { |
1051 if (cmdchar != 'r' && cmdchar != 'v') | 1051 // When CTRL-C was typed got_int will be set, with the result |
1052 // that the autocommands won't be executed. When mapped got_int | |
1053 // is not set, but let's keep the behavior the same. | |
1054 if (cmdchar != 'r' && cmdchar != 'v' && c != Ctrl_C) | |
1052 ins_apply_autocmds(EVENT_INSERTLEAVE); | 1055 ins_apply_autocmds(EVENT_INSERTLEAVE); |
1053 did_cursorhold = FALSE; | 1056 did_cursorhold = FALSE; |
1054 return (c == Ctrl_O); | 1057 return (c == Ctrl_O); |
1055 } | 1058 } |
1056 continue; | 1059 continue; |
2406 * This depends on the current mode. | 2409 * This depends on the current mode. |
2407 */ | 2410 */ |
2408 int | 2411 int |
2409 vim_is_ctrl_x_key(int c) | 2412 vim_is_ctrl_x_key(int c) |
2410 { | 2413 { |
2411 /* Always allow ^R - let it's results then be checked */ | 2414 // Always allow ^R - let its results then be checked |
2412 if (c == Ctrl_R) | 2415 if (c == Ctrl_R) |
2413 return TRUE; | 2416 return TRUE; |
2414 | 2417 |
2415 /* Accept <PageUp> and <PageDown> if the popup menu is visible. */ | 2418 /* Accept <PageUp> and <PageDown> if the popup menu is visible. */ |
2416 if (ins_compl_pum_key(c)) | 2419 if (ins_compl_pum_key(c)) |