comparison src/ops.c @ 14004:e124262d435e v8.1.0020

patch 8.1.0020: cannot tell whether a register is executing or recording commit https://github.com/vim/vim/commit/0b6d911e5de1a1c10a23d4c2ee1b0275c474a2dd Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 22 20:35:17 2018 +0200 patch 8.1.0020: cannot tell whether a register is executing or recording Problem: Cannot tell whether a register is being used for executing or recording. Solution: Add reg_executing() and reg_recording(). (Hirohito Higashi, closes #2745) Rename the global variables for consistency. Store the register name in reg_executing.
author Christian Brabandt <cb@256bit.org>
date Tue, 22 May 2018 20:45:05 +0200
parents 1f95ec5de238
children dc67449d648c
comparison
equal deleted inserted replaced
14003:3965a5a6215e 14004:e124262d435e
1089 char_u *p; 1089 char_u *p;
1090 static int regname; 1090 static int regname;
1091 yankreg_T *old_y_previous, *old_y_current; 1091 yankreg_T *old_y_previous, *old_y_current;
1092 int retval; 1092 int retval;
1093 1093
1094 if (Recording == FALSE) /* start recording */ 1094 if (reg_recording == 0) /* start recording */
1095 { 1095 {
1096 /* registers 0-9, a-z and " are allowed */ 1096 /* registers 0-9, a-z and " are allowed */
1097 if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) 1097 if (c < 0 || (!ASCII_ISALNUM(c) && c != '"'))
1098 retval = FAIL; 1098 retval = FAIL;
1099 else 1099 else
1100 { 1100 {
1101 Recording = c; 1101 reg_recording = c;
1102 showmode(); 1102 showmode();
1103 regname = c; 1103 regname = c;
1104 retval = OK; 1104 retval = OK;
1105 } 1105 }
1106 } 1106 }
1109 /* 1109 /*
1110 * Get the recorded key hits. K_SPECIAL and CSI will be escaped, this 1110 * Get the recorded key hits. K_SPECIAL and CSI will be escaped, this
1111 * needs to be removed again to put it in a register. exec_reg then 1111 * needs to be removed again to put it in a register. exec_reg then
1112 * adds the escaping back later. 1112 * adds the escaping back later.
1113 */ 1113 */
1114 Recording = FALSE; 1114 reg_recording = 0;
1115 MSG(""); 1115 MSG("");
1116 p = get_recorded(); 1116 p = get_recorded();
1117 if (p == NULL) 1117 if (p == NULL)
1118 retval = FAIL; 1118 retval = FAIL;
1119 else 1119 else
1316 return FAIL; 1316 return FAIL;
1317 if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent) 1317 if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
1318 == FAIL) 1318 == FAIL)
1319 return FAIL; 1319 return FAIL;
1320 } 1320 }
1321 Exec_reg = TRUE; /* disable the 'q' command */ 1321 reg_executing = regname == 0 ? '"' : regname; // disable "q" command
1322 } 1322 }
1323 return retval; 1323 return retval;
1324 } 1324 }
1325 1325
1326 /* 1326 /*