diff -Naur Vim_orig/vim/runtime/doc/options.txt Vim_nlines/vim/runtime/doc/options.txt --- Vim_orig/vim/runtime/doc/options.txt 2008-03-29 14:30:55.000000000 +0100 +++ Vim_nlines/vim/runtime/doc/options.txt 2008-03-29 15:02:00.000000000 +0100 @@ -5168,6 +5168,15 @@ Insert mode completion. When zero as much space as available is used. |ins-completion-menu|. + *'pumshift'* *'ps'* +'pumshift' 'ps' number (default 2) + global + {not available when compiled without the + |+insert_expand| feature} + {not in Vi} + Determines the maximum number of lines to leave between the cursor and + the popup menu for Insert mode completion. + |ins-completion-menu|. *'quoteescape'* *'qe'* 'quoteescape' 'qe' string (default "\") diff -Naur Vim_orig/vim/runtime/doc/tags Vim_nlines/vim/runtime/doc/tags --- Vim_orig/vim/runtime/doc/tags 2007-05-12 14:09:10.000000000 +0200 +++ Vim_nlines/vim/runtime/doc/tags 2008-03-29 15:01:56.000000000 +0100 @@ -697,6 +697,7 @@ 'prompt' options.txt /*'prompt'* 'pt' options.txt /*'pt'* 'pumheight' options.txt /*'pumheight'* +'pumshift' options.txt /*'pumshift'* 'pvh' options.txt /*'pvh'* 'pvw' options.txt /*'pvw'* 'qe' options.txt /*'qe'* diff -Naur Vim_orig/vim/src/option.c Vim_nlines/vim/src/option.c --- Vim_orig/vim/src/option.c 2008-03-29 14:30:55.000000000 +0100 +++ Vim_nlines/vim/src/option.c 2008-03-29 15:02:38.000000000 +0100 @@ -1977,6 +1977,13 @@ (char_u *)NULL, PV_NONE, #endif {(char_u *)0L, (char_u *)0L}}, + {"pumshift", "ps", P_NUM|P_VI_DEF, +#ifdef FEAT_INS_EXPAND + (char_u *)&p_ps, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)2L, (char_u *)2L}}, {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, #ifdef FEAT_TEXTOBJ (char_u *)&p_qe, PV_QE, diff -Naur Vim_orig/vim/src/option.h Vim_nlines/vim/src/option.h --- Vim_orig/vim/src/option.h 2008-03-29 14:30:26.000000000 +0100 +++ Vim_nlines/vim/src/option.h 2008-03-29 15:02:43.000000000 +0100 @@ -381,6 +381,7 @@ #ifdef FEAT_INS_EXPAND EXTERN char_u *p_cot; /* 'completeopt' */ EXTERN long p_ph; /* 'pumheight' */ +EXTERN long p_ps; /* 'pumshift' */ #endif EXTERN char_u *p_cpo; /* 'cpoptions' */ #ifdef FEAT_CSCOPE diff -Naur Vim_orig/vim/src/popupmnu.c Vim_nlines/vim/src/popupmnu.c --- Vim_orig/vim/src/popupmnu.c 2008-03-29 14:30:59.000000000 +0100 +++ Vim_nlines/vim/src/popupmnu.c 2008-03-29 15:02:33.000000000 +0100 @@ -73,8 +73,13 @@ validate_cursor_col(); pum_array = NULL; - row = curwin->w_cline_row + W_WINROW(curwin); - height = curwin->w_cline_height; + row = curwin->w_wrow + W_WINROW(curwin); + + /* Leave some lines of context if possible */ + if (curwin->w_cline_height - curwin->w_wrow >= p_ps + 1) + height = p_ps + 1; + else + height = curwin->w_cline_height - curwin->w_wrow; if (firstwin->w_p_pvw) top_clear = firstwin->w_height;