Mercurial > vim
comparison src/popupmnu.c @ 1622:149d8b46404c
updated for version 7.2a
author | vimboss |
---|---|
date | Tue, 24 Jun 2008 22:09:24 +0000 |
parents | f0cfff4dcc2f |
children | 0b796e045c42 |
comparison
equal
deleted
inserted
replaced
1621:82b5078be2dd | 1622:149d8b46404c |
---|---|
54 int kind_width; | 54 int kind_width; |
55 int extra_width; | 55 int extra_width; |
56 int i; | 56 int i; |
57 int top_clear; | 57 int top_clear; |
58 int row; | 58 int row; |
59 int height; | 59 int context_lines; |
60 int col; | 60 int col; |
61 int above_row = cmdline_row; | 61 int above_row = cmdline_row; |
62 int redo_count = 0; | 62 int redo_count = 0; |
63 | 63 |
64 redo: | 64 redo: |
71 * 'cuc' is on. */ | 71 * 'cuc' is on. */ |
72 pum_array = (pumitem_T *)1; | 72 pum_array = (pumitem_T *)1; |
73 validate_cursor_col(); | 73 validate_cursor_col(); |
74 pum_array = NULL; | 74 pum_array = NULL; |
75 | 75 |
76 row = curwin->w_cline_row + W_WINROW(curwin); | 76 row = curwin->w_wrow + W_WINROW(curwin); |
77 height = curwin->w_cline_height; | |
78 | 77 |
79 if (firstwin->w_p_pvw) | 78 if (firstwin->w_p_pvw) |
80 top_clear = firstwin->w_height; | 79 top_clear = firstwin->w_height; |
81 else | 80 else |
82 top_clear = 0; | 81 top_clear = 0; |
97 if (p_ph > 0 && pum_height > p_ph) | 96 if (p_ph > 0 && pum_height > p_ph) |
98 pum_height = p_ph; | 97 pum_height = p_ph; |
99 | 98 |
100 /* Put the pum below "row" if possible. If there are few lines decide on | 99 /* Put the pum below "row" if possible. If there are few lines decide on |
101 * where there is more room. */ | 100 * where there is more room. */ |
102 if (row >= above_row - pum_height | 101 if (row + 2 >= above_row - pum_height |
103 && row > (above_row - top_clear - height) / 2) | 102 && row > (above_row - top_clear) / 2) |
104 { | 103 { |
105 /* pum above "row" */ | 104 /* pum above "row" */ |
106 if (row >= size) | 105 |
107 { | 106 /* Leave two lines of context if possible */ |
108 pum_row = row - size; | 107 if (curwin->w_wrow - curwin->w_cline_row >= 2) |
108 context_lines = 2; | |
109 else | |
110 context_lines = curwin->w_wrow - curwin->w_cline_row; | |
111 | |
112 if (row >= size + context_lines) | |
113 { | |
114 pum_row = row - size - context_lines; | |
109 pum_height = size; | 115 pum_height = size; |
110 } | 116 } |
111 else | 117 else |
112 { | 118 { |
113 pum_row = 0; | 119 pum_row = 0; |
114 pum_height = row; | 120 pum_height = row - context_lines; |
115 } | 121 } |
116 if (p_ph > 0 && pum_height > p_ph) | 122 if (p_ph > 0 && pum_height > p_ph) |
117 { | 123 { |
118 pum_row += pum_height - p_ph; | 124 pum_row += pum_height - p_ph; |
119 pum_height = p_ph; | 125 pum_height = p_ph; |
120 } | 126 } |
121 } | 127 } |
122 else | 128 else |
123 { | 129 { |
124 /* pum below "row" */ | 130 /* pum below "row" */ |
125 pum_row = row + height; | 131 |
132 /* Leave two lines of context if possible */ | |
133 if (curwin->w_cline_row + curwin->w_cline_height - curwin->w_wrow >= 3) | |
134 context_lines = 3; | |
135 else | |
136 context_lines = curwin->w_cline_row | |
137 + curwin->w_cline_height - curwin->w_wrow; | |
138 | |
139 pum_row = row + context_lines; | |
126 if (size > above_row - pum_row) | 140 if (size > above_row - pum_row) |
127 pum_height = above_row - pum_row; | 141 pum_height = above_row - pum_row; |
128 else | 142 else |
129 pum_height = size; | 143 pum_height = size; |
130 if (p_ph > 0 && pum_height > p_ph) | 144 if (p_ph > 0 && pum_height > p_ph) |