aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2016-12-10 17:02:02 +0900
committerJustin M. Keyes <justinkz@gmail.com>2016-12-26 22:21:14 +0100
commit4431975210b58c6b0403ee50172bad3c8729bbb2 (patch)
tree568788b07faa6ebab59e0dfcf56f11fbbe0c6985 /src/nvim/edit.c
parente9a2f77bff013345e3114dc9189ae8ce456b0622 (diff)
downloadrneovim-4431975210b58c6b0403ee50172bad3c8729bbb2.tar.gz
rneovim-4431975210b58c6b0403ee50172bad3c8729bbb2.tar.bz2
rneovim-4431975210b58c6b0403ee50172bad3c8729bbb2.zip
vim-patch:0 completion-related patches #5745 #5829
vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 164194f5a7..7e917336e5 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3267,7 +3267,7 @@ static bool ins_compl_prep(int c)
dec_cursor();
}
- if (!arrow_used && !ins_need_undo) {
+ if (!arrow_used && !ins_need_undo && c != Ctrl_E) {
insertchar(NUL, 0, -1);
}
@@ -3286,7 +3286,8 @@ static bool ins_compl_prep(int c)
retval = true;
}
- /* CTRL-E means completion is Ended, go back to the typed text. */
+ // CTRL-E means completion is Ended, go back to the typed text.
+ // but only do this, if the Popup is still visible
if (c == Ctrl_E) {
ins_compl_delete();
if (compl_leader != NULL) {
@@ -4516,14 +4517,15 @@ static int ins_complete(int c, bool enable_pum)
} else if (ctrl_x_mode == CTRL_X_CMDLINE) {
compl_pattern = vim_strnsave(line, curs_col);
set_cmd_context(&compl_xp, compl_pattern,
- (int)STRLEN(compl_pattern), curs_col);
+ (int)STRLEN(compl_pattern), curs_col, false);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
- || compl_xp.xp_context == EXPAND_NOTHING)
- /* No completion possible, use an empty pattern to get a
- * "pattern not found" message. */
+ || compl_xp.xp_context == EXPAND_NOTHING) {
+ // No completion possible, use an empty pattern to get a
+ // "pattern not found" message.
compl_col = curs_col;
- else
+ } else {
compl_col = (int)(compl_xp.xp_pattern - compl_pattern);
+ }
compl_length = curs_col - compl_col;
} else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode ==
CTRL_X_OMNI) {