diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-12-10 17:02:02 +0900 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-12-26 22:21:14 +0100 |
commit | 4431975210b58c6b0403ee50172bad3c8729bbb2 (patch) | |
tree | 568788b07faa6ebab59e0dfcf56f11fbbe0c6985 /src/nvim/popupmnu.c | |
parent | e9a2f77bff013345e3114dc9189ae8ce456b0622 (diff) | |
download | rneovim-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/popupmnu.c')
-rw-r--r-- | src/nvim/popupmnu.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 947814de4f..89180f76de 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -67,12 +67,13 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) int kind_width; int extra_width; int i; - int top_clear; int row; int context_lines; int col; - int above_row = cmdline_row; + int above_row; + int below_row; int redo_count = 0; + win_T *pvwin; if (!pum_is_visible) { // To keep the code simple, we only allow changing the @@ -85,6 +86,8 @@ redo: // to avoid that must_redraw is set when 'cursorcolumn' is on. pum_is_visible = true; validate_cursor_col(); + above_row = 0; + below_row = cmdline_row; // anchor position: the start of the completed word row = curwin->w_wrow + curwin->w_winrow; @@ -123,17 +126,18 @@ redo: kind_width = 0; extra_width = 0; - if (firstwin->w_p_pvw) { - top_clear = firstwin->w_height; - } else { - top_clear = 0; + FOR_ALL_WINDOWS(pvwin) { + if (pvwin->w_p_pvw) { + break; + } } - // When the preview window is at the bottom stop just above it. Also - // avoid drawing over the status line so that it's clear there is a window - // boundary. - if (lastwin->w_p_pvw) { - above_row -= lastwin->w_height + lastwin->w_status_height + 1; + if (pvwin != NULL) { + if (pvwin->w_wrow < curwin->w_wrow) { + above_row = pvwin->w_wrow + pvwin->w_height; + } else if (pvwin->w_wrow > pvwin->w_wrow + curwin->w_height) { + below_row = pvwin->w_wrow; + } } // Figure out the size and position of the pum. @@ -149,8 +153,8 @@ redo: // Put the pum below "row" if possible. If there are few lines decide on // where there is more room. - if ((row + 2 >= above_row - pum_height) - && (row > (above_row - top_clear) / 2)) { + if (row + 2 >= below_row - pum_height + && row - above_row > (below_row - above_row) / 2) { // pum above "row" // Leave two lines of context if possible @@ -184,8 +188,8 @@ redo: } pum_row = row + context_lines; - if (size > above_row - pum_row) { - pum_height = above_row - pum_row; + if (size > below_row - pum_row) { + pum_height = below_row - pum_row; } else { pum_height = size; } @@ -200,12 +204,10 @@ redo: return; } - // If there is a preview window at the top avoid drawing over it. - if (firstwin->w_p_pvw - && (pum_row < firstwin->w_height) - && (pum_height > firstwin->w_height + 4)) { - pum_row += firstwin->w_height; - pum_height -= firstwin->w_height; + // If there is a preview window at the above avoid drawing over it. + if (pvwin != NULL && pum_row < above_row && pum_height > above_row) { + pum_row += above_row; + pum_height -= above_row; } // Compute the width of the widest match and the widest extra. @@ -588,7 +590,9 @@ static int pum_set_selected(int n, int repeat) g_do_tagpreview = 0; if (curwin->w_p_pvw) { - if ((curbuf->b_fname == NULL) + if (!resized + && (curbuf->b_nwindows == 1) + && (curbuf->b_fname == NULL) && (curbuf->b_p_bt[0] == 'n') && (curbuf->b_p_bt[2] == 'f') && (curbuf->b_p_bh[0] == 'w')) { |