aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-09-10 20:47:33 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-12-29 18:34:04 -0500
commitd56f36f46c400ead225caaef8ac2717ff1e4bfec (patch)
tree5ab8a299d9753270fa24671a6dfdfb2018341d4c
parentac85d1f52f0d298b03f7d0e0be3f4b7ce777cae7 (diff)
downloadrneovim-d56f36f46c400ead225caaef8ac2717ff1e4bfec.tar.gz
rneovim-d56f36f46c400ead225caaef8ac2717ff1e4bfec.tar.bz2
rneovim-d56f36f46c400ead225caaef8ac2717ff1e4bfec.zip
vim-patch:8.0.1522: popup menu is positioned in the wrong place
Problem: Popup menu is positioned in the wrong place. (Davit Samvelyan, Boris Staletic) Solution: Correct computation of the column and the conditions for that. (Hirohito Higashi, closes vim/vim#2640) https://github.com/vim/vim/commit/4287ed33ddc324d26dd05d3e19596dd74cf479d6
-rw-r--r--src/nvim/popupmnu.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 561cb846f1..a715129f8a 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -305,22 +305,25 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
&& (col < Columns - p_pw
|| col < Columns - max_width))) {
// align right pum edge with "col"
- if (curwin->w_p_rl) {
+ if (curwin->w_p_rl
+ && col < max_width + pum_scrollbar + 1) {
pum_col = col + max_width + pum_scrollbar + 1;
if (pum_col >= Columns) {
pum_col = Columns - 1;
}
- } else {
- pum_col = col - max_width - pum_scrollbar;
- if (pum_col < 0) {
- pum_col = 0;
+ } else if (!curwin->w_p_rl) {
+ if (col > Columns - max_width - pum_scrollbar) {
+ pum_col = col - max_width - pum_scrollbar;
+ if (pum_col < 0) {
+ pum_col = 0;
+ }
}
}
if (curwin->w_p_rl) {
- pum_width = W_ENDCOL(curwin) - pum_col - pum_scrollbar + 1;
+ pum_width = pum_col - pum_scrollbar + 1;
} else {
- pum_width = pum_col - pum_scrollbar;
+ pum_width = Columns - pum_col - pum_scrollbar;
}
if (pum_width < p_pw) {