diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-03-15 22:59:18 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-03-15 22:59:18 +0000 |
commit | 7d47b6eed707db9af160ec517b71e1f9fdac1a0f (patch) | |
tree | f93785b6fba72029e272fac10caed4cda5c09f4e /src/popupmenu.c | |
parent | 5671873089d516a10c79733182797075071eb5f3 (diff) | |
download | vim-git-7d47b6eed707db9af160ec517b71e1f9fdac1a0f.tar.gz |
updated for version 7.0225
Diffstat (limited to 'src/popupmenu.c')
-rw-r--r-- | src/popupmenu.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c index 5126e8647..ca3547cb5 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -87,11 +87,13 @@ redo: pum_height = size; else pum_height = PUM_DEF_HEIGHT; + if (p_ph > 0 && pum_height > p_ph) + pum_height = p_ph; /* Put the pum below "row" if possible. If there are few lines decide on * where there is more room. */ - if (row >= cmdline_row - top_clear - pum_height - && row > (cmdline_row - top_clear - height) / 2) + if (row >= cmdline_row - pum_height + && row > (cmdline_row - top_clear - height) / 2) { /* pum above "row" */ if (row >= size) @@ -104,6 +106,11 @@ redo: pum_row = 0; pum_height = row; } + if (p_ph > 0 && pum_height > p_ph) + { + pum_row += pum_height - p_ph; + pum_height = p_ph; + } } else { @@ -113,6 +120,8 @@ redo: pum_height = cmdline_row - pum_row; else pum_height = size; + if (p_ph > 0 && pum_height > p_ph) + pum_height = p_ph; } /* don't display when we only have room for one line */ @@ -214,7 +223,7 @@ pum_redraw() int i; int idx; char_u *s; - char_u *p; + char_u *p = NULL; int totwidth, width, w; int thumb_pos = 0; int thumb_heigth = 1; @@ -330,6 +339,7 @@ pum_set_selected(n) int n; { int resized = FALSE; + int context = pum_height / 2; pum_selected = n; @@ -364,20 +374,22 @@ pum_set_selected(n) pum_first = pum_selected - pum_height + 1; } - if (pum_height > 6) + /* Give a few lines of context when possible. */ + if (context > 3) + context = 3; + if (pum_height > 2) { - /* Give three lines of context when possible. */ - if (pum_first > pum_selected - 3) + if (pum_first > pum_selected - context) { /* scroll down */ - pum_first = pum_selected - 3; + pum_first = pum_selected - context; if (pum_first < 0) pum_first = 0; } - else if (pum_first < pum_selected + 3 - pum_height + 1) + else if (pum_first < pum_selected + context - pum_height + 1) { /* scroll up */ - pum_first = pum_selected + 3 - pum_height + 1; + pum_first = pum_selected + context - pum_height + 1; } } @@ -479,6 +491,12 @@ pum_set_selected(n) if (win_valid(curwin_save)) win_enter(curwin_save, TRUE); + + /* May need to update the screen again when there are + * autocommands involved. */ + pum_do_redraw = TRUE; + update_screen(0); + pum_do_redraw = FALSE; } } } |