Mercurial > vim
comparison src/edit.c @ 31293:ff4473b3fc58 v9.0.0980
patch 9.0.0980: the keyboard state response may end up in a shell command
Commit: https://github.com/vim/vim/commit/733a69b29f0b0c3d2ddca463a41bdd912379bc5e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 1 12:03:47 2022 +0000
patch 9.0.0980: the keyboard state response may end up in a shell command
Problem: The keyboard state response may end up in a shell command.
Solution: Only request the keyboard protocol state when the typeahead is
empty, no more commands are following and not exiting. Add the
t_RK termcap entry for this.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 01 Dec 2022 13:15:03 +0100 |
parents | dcde141f2d1e |
children | 627d4f236ac8 |
comparison
equal
deleted
inserted
replaced
31292:f319f6200220 | 31293:ff4473b3fc58 |
---|---|
569 #endif | 569 #endif |
570 | 570 |
571 #ifdef USE_ON_FLY_SCROLL | 571 #ifdef USE_ON_FLY_SCROLL |
572 dont_scroll = FALSE; // allow scrolling here | 572 dont_scroll = FALSE; // allow scrolling here |
573 #endif | 573 #endif |
574 // May request the keyboard protocol state now. | |
575 may_send_t_RK(); | |
574 | 576 |
575 /* | 577 /* |
576 * Get a character for Insert mode. Ignore K_IGNORE and K_NOP. | 578 * Get a character for Insert mode. Ignore K_IGNORE and K_NOP. |
577 */ | 579 */ |
578 if (c != K_CURSORHOLD) | 580 if (c != K_CURSORHOLD) |
1477 && !pum_visible()) | 1479 && !pum_visible()) |
1478 { | 1480 { |
1479 aco_save_T aco; | 1481 aco_save_T aco; |
1480 varnumber_T tick = CHANGEDTICK(curbuf); | 1482 varnumber_T tick = CHANGEDTICK(curbuf); |
1481 | 1483 |
1482 // save and restore curwin and curbuf, in case the autocmd changes them | 1484 // Save and restore curwin and curbuf, in case the autocmd changes |
1485 // them. | |
1483 aucmd_prepbuf(&aco, curbuf); | 1486 aucmd_prepbuf(&aco, curbuf); |
1484 apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); | 1487 apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); |
1485 aucmd_restbuf(&aco); | 1488 aucmd_restbuf(&aco); |
1486 curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); | 1489 curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); |
1487 if (tick != CHANGEDTICK(curbuf)) // see ins_apply_autocmds() | 1490 if (tick != CHANGEDTICK(curbuf)) // see ins_apply_autocmds() |
1497 && pum_visible()) | 1500 && pum_visible()) |
1498 { | 1501 { |
1499 aco_save_T aco; | 1502 aco_save_T aco; |
1500 varnumber_T tick = CHANGEDTICK(curbuf); | 1503 varnumber_T tick = CHANGEDTICK(curbuf); |
1501 | 1504 |
1502 // save and restore curwin and curbuf, in case the autocmd changes them | 1505 // Save and restore curwin and curbuf, in case the autocmd changes |
1506 // them. | |
1503 aucmd_prepbuf(&aco, curbuf); | 1507 aucmd_prepbuf(&aco, curbuf); |
1504 apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf); | 1508 apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf); |
1505 aucmd_restbuf(&aco); | 1509 aucmd_restbuf(&aco); |
1506 curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); | 1510 curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); |
1507 if (tick != CHANGEDTICK(curbuf)) // see ins_apply_autocmds() | 1511 if (tick != CHANGEDTICK(curbuf)) // see ins_apply_autocmds() |
3704 | 3708 |
3705 // Re-enable bracketed paste mode. | 3709 // Re-enable bracketed paste mode. |
3706 out_str(T_BE); | 3710 out_str(T_BE); |
3707 | 3711 |
3708 // Re-enable modifyOtherKeys. | 3712 // Re-enable modifyOtherKeys. |
3709 out_str(T_CTI); | 3713 out_str_t_TI(); |
3710 } | 3714 } |
3711 #ifdef FEAT_CONCEAL | 3715 #ifdef FEAT_CONCEAL |
3712 // Check if the cursor line needs redrawing after changing State. If | 3716 // Check if the cursor line needs redrawing after changing State. If |
3713 // 'concealcursor' is "i" it needs to be redrawn without concealing. | 3717 // 'concealcursor' is "i" it needs to be redrawn without concealing. |
3714 conceal_check_cursor_line(cursor_line_was_concealed); | 3718 conceal_check_cursor_line(cursor_line_was_concealed); |
4382 if (end == NULL && vpeekc() == NUL) | 4386 if (end == NULL && vpeekc() == NUL) |
4383 break; | 4387 break; |
4384 do | 4388 do |
4385 c = vgetc(); | 4389 c = vgetc(); |
4386 while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); | 4390 while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); |
4391 | |
4387 if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C)) | 4392 if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C)) |
4388 // When CTRL-C was encountered the typeahead will be flushed and we | 4393 // When CTRL-C was encountered the typeahead will be flushed and we |
4389 // won't get the end sequence. Except when using ":normal". | 4394 // won't get the end sequence. Except when using ":normal". |
4390 break; | 4395 break; |
4391 | 4396 |