Mercurial > vim
comparison src/normal.c @ 32317:39320e75f567 v9.0.1490
patch 9.0.1490: the ModeChanged event may be triggered too often
Commit: https://github.com/vim/vim/commit/73916bac5ac2a054a0c71adfe8d742691cdfd95c
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Apr 26 16:50:19 2023 +0100
patch 9.0.1490: the ModeChanged event may be triggered too often
Problem: The ModeChanged event may be triggered too often.
Solution: Only trigger ModeChanged when no operator is pending.
(closes #12298)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 26 Apr 2023 18:00:05 +0200 |
parents | 7d552e52fe92 |
children | 11bc7fa31c3b |
comparison
equal
deleted
inserted
replaced
32316:02c07726ccda | 32317:39320e75f567 |
---|---|
973 #ifdef FEAT_EVAL | 973 #ifdef FEAT_EVAL |
974 if (finish_op) | 974 if (finish_op) |
975 reset_reg_var(); | 975 reset_reg_var(); |
976 #endif | 976 #endif |
977 | 977 |
978 // Reset finish_op, in case it was set | |
979 #ifdef CURSOR_SHAPE | 978 #ifdef CURSOR_SHAPE |
980 int prev_finish_op = finish_op; | 979 int prev_finish_op = finish_op; |
981 #endif | 980 #endif |
982 finish_op = FALSE; | 981 if (oap->op_type == OP_NOP) |
983 may_trigger_modechanged(); | 982 { |
983 // Reset finish_op, in case it was set | |
984 finish_op = FALSE; | |
985 may_trigger_modechanged(); | |
986 } | |
984 #ifdef CURSOR_SHAPE | 987 #ifdef CURSOR_SHAPE |
985 // Redraw the cursor with another shape, if we were in Operator-pending | 988 // Redraw the cursor with another shape, if we were in Operator-pending |
986 // mode or did a replace command. | 989 // mode or did a replace command. |
987 if (prev_finish_op || ca.cmdchar == 'r' | 990 if (prev_finish_op || ca.cmdchar == 'r' |
988 || (ca.cmdchar == 'g' && ca.nchar == 'r')) | 991 || (ca.cmdchar == 'g' && ca.nchar == 'r')) |
993 # endif | 996 # endif |
994 } | 997 } |
995 #endif | 998 #endif |
996 | 999 |
997 if (oap->op_type == OP_NOP && oap->regname == 0 | 1000 if (oap->op_type == OP_NOP && oap->regname == 0 |
998 && ca.cmdchar != K_CURSORHOLD) | 1001 && ca.cmdchar != K_CURSORHOLD) |
999 clear_showcmd(); | 1002 clear_showcmd(); |
1000 | 1003 |
1001 checkpcmark(); // check if we moved since setting pcmark | 1004 checkpcmark(); // check if we moved since setting pcmark |
1002 vim_free(ca.searchbuf); | 1005 vim_free(ca.searchbuf); |
1003 | 1006 |
1494 if (cmd5 != NUL) | 1497 if (cmd5 != NUL) |
1495 AppendCharToRedobuff(cmd5); | 1498 AppendCharToRedobuff(cmd5); |
1496 } | 1499 } |
1497 | 1500 |
1498 /* | 1501 /* |
1499 * check for operator active and clear it | 1502 * Check for operator active and clear it. |
1500 * | 1503 * |
1501 * return TRUE if operator was active | 1504 * Beep and return TRUE if an operator was active. |
1502 */ | 1505 */ |
1503 static int | 1506 static int |
1504 checkclearop(oparg_T *oap) | 1507 checkclearop(oparg_T *oap) |
1505 { | 1508 { |
1506 if (oap->op_type == OP_NOP) | 1509 if (oap->op_type == OP_NOP) |
1510 } | 1513 } |
1511 | 1514 |
1512 /* | 1515 /* |
1513 * Check for operator or Visual active. Clear active operator. | 1516 * Check for operator or Visual active. Clear active operator. |
1514 * | 1517 * |
1515 * Return TRUE if operator or Visual was active. | 1518 * Beep and return TRUE if an operator or Visual was active. |
1516 */ | 1519 */ |
1517 static int | 1520 static int |
1518 checkclearopq(oparg_T *oap) | 1521 checkclearopq(oparg_T *oap) |
1519 { | 1522 { |
1520 if (oap->op_type == OP_NOP && !VIsual_active) | 1523 if (oap->op_type == OP_NOP && !VIsual_active) |