Mercurial > vim
comparison src/edit.c @ 13215:ae5f855a64be v8.0.1482
patch 8.0.1482: using feedkeys() does not work to test completion
commit https://github.com/vim/vim/commit/02ae9b4a93deea4993d7abe20485f91f1cce5e36
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 9 15:06:02 2018 +0100
patch 8.0.1482: using feedkeys() does not work to test completion
Problem: Using feedkeys() does not work to test Insert mode completion.
(Lifepillar)
Solution: Do not check for typed keys when executing :normal or feedkeys().
Fix thesaurus completion not working when 'complete' is empty.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 09 Feb 2018 15:15:06 +0100 |
parents | ed51483e9971 |
children | e0dcfd3dbb52 |
comparison
equal
deleted
inserted
replaced
13214:ed51483e9971 | 13215:ae5f855a64be |
---|---|
1452 case Ctrl_P: /* Do previous/next pattern completion */ | 1452 case Ctrl_P: /* Do previous/next pattern completion */ |
1453 case Ctrl_N: | 1453 case Ctrl_N: |
1454 /* if 'complete' is empty then plain ^P is no longer special, | 1454 /* if 'complete' is empty then plain ^P is no longer special, |
1455 * but it is under other ^X modes */ | 1455 * but it is under other ^X modes */ |
1456 if (*curbuf->b_p_cpt == NUL | 1456 if (*curbuf->b_p_cpt == NUL |
1457 && ctrl_x_mode != 0 | 1457 && (ctrl_x_mode == CTRL_X_NORMAL |
1458 || ctrl_x_mode == CTRL_X_WHOLE_LINE) | |
1458 && !(compl_cont_status & CONT_LOCAL)) | 1459 && !(compl_cont_status & CONT_LOCAL)) |
1459 goto normalchar; | 1460 goto normalchar; |
1460 | 1461 |
1461 docomplete: | 1462 docomplete: |
1462 compl_busy = TRUE; | 1463 compl_busy = TRUE; |
1566 | 1567 |
1567 #ifdef FEAT_AUTOCMD | 1568 #ifdef FEAT_AUTOCMD |
1568 /* If typed something may trigger CursorHoldI again. */ | 1569 /* If typed something may trigger CursorHoldI again. */ |
1569 if (c != K_CURSORHOLD | 1570 if (c != K_CURSORHOLD |
1570 # ifdef FEAT_COMPL_FUNC | 1571 # ifdef FEAT_COMPL_FUNC |
1571 /* but not in CTRL-X mode, a script can't restore the state */ | 1572 /* but not in CTRL-X mode, a script can't restore the state */ |
1572 && ctrl_x_mode == 0 | 1573 && ctrl_x_mode == CTRL_X_NORMAL |
1573 # endif | 1574 # endif |
1574 ) | 1575 ) |
1575 did_cursorhold = FALSE; | 1576 did_cursorhold = FALSE; |
1576 #endif | 1577 #endif |
1577 | 1578 |
1580 inserted_space = FALSE; | 1581 inserted_space = FALSE; |
1581 | 1582 |
1582 #ifdef FEAT_CINDENT | 1583 #ifdef FEAT_CINDENT |
1583 if (can_cindent && cindent_on() | 1584 if (can_cindent && cindent_on() |
1584 # ifdef FEAT_INS_EXPAND | 1585 # ifdef FEAT_INS_EXPAND |
1585 && ctrl_x_mode == 0 | 1586 && ctrl_x_mode == CTRL_X_NORMAL |
1586 # endif | 1587 # endif |
1587 ) | 1588 ) |
1588 { | 1589 { |
1589 force_cindent: | 1590 force_cindent: |
1590 /* | 1591 /* |
5018 */ | 5019 */ |
5019 void | 5020 void |
5020 ins_compl_check_keys(int frequency, int in_compl_func) | 5021 ins_compl_check_keys(int frequency, int in_compl_func) |
5021 { | 5022 { |
5022 static int count = 0; | 5023 static int count = 0; |
5023 | 5024 int c; |
5024 int c; | 5025 |
5025 | 5026 /* Don't check when reading keys from a script, :normal or feedkeys(). |
5026 /* Don't check when reading keys from a script. That would break the test | 5027 * That would break the test scripts. But do check for keys when called |
5027 * scripts */ | 5028 * from complete_check(). */ |
5028 if (using_script()) | 5029 if (!in_compl_func && (using_script() || ex_normal_busy)) |
5029 return; | 5030 return; |
5030 | 5031 |
5031 /* Only do this at regular intervals */ | 5032 /* Only do this at regular intervals */ |
5032 if (++count < frequency) | 5033 if (++count < frequency) |
5033 return; | 5034 return; |