Mercurial > vim
comparison src/popupwin.c @ 16888:ec61b6b79865 v8.1.1445
patch 8.1.1445: popup window border highlight not implemented yet
commit https://github.com/vim/vim/commit/790498b509443f96f39431d2bc87b777efbe250f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 1 22:15:29 2019 +0200
patch 8.1.1445: popup window border highlight not implemented yet
Problem: Popup window border highlight not implemented yet.
Solution: Implement the "borderhighlight" option.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Jun 2019 22:30:05 +0200 |
parents | 59e4148c0c73 |
children | 5131023c5728 |
comparison
equal
deleted
inserted
replaced
16887:a8aa4c4ffa4a | 16888:ec61b6b79865 |
---|---|
142 apply_options(win_T *wp, buf_T *buf UNUSED, dict_T *dict, int atcursor) | 142 apply_options(win_T *wp, buf_T *buf UNUSED, dict_T *dict, int atcursor) |
143 { | 143 { |
144 int nr; | 144 int nr; |
145 char_u *str; | 145 char_u *str; |
146 dictitem_T *di; | 146 dictitem_T *di; |
147 int i; | |
147 | 148 |
148 wp->w_minwidth = dict_get_number(dict, (char_u *)"minwidth"); | 149 wp->w_minwidth = dict_get_number(dict, (char_u *)"minwidth"); |
149 wp->w_minheight = dict_get_number(dict, (char_u *)"minheight"); | 150 wp->w_minheight = dict_get_number(dict, (char_u *)"minheight"); |
150 wp->w_maxwidth = dict_get_number(dict, (char_u *)"maxwidth"); | 151 wp->w_maxwidth = dict_get_number(dict, (char_u *)"maxwidth"); |
151 wp->w_maxheight = dict_get_number(dict, (char_u *)"maxheight"); | 152 wp->w_maxheight = dict_get_number(dict, (char_u *)"maxheight"); |
209 set_callback(&wp->w_filter_cb, &callback); | 210 set_callback(&wp->w_filter_cb, &callback); |
210 } | 211 } |
211 | 212 |
212 get_padding_border(dict, wp->w_popup_padding, "padding", 999); | 213 get_padding_border(dict, wp->w_popup_padding, "padding", 999); |
213 get_padding_border(dict, wp->w_popup_border, "border", 1); | 214 get_padding_border(dict, wp->w_popup_border, "border", 1); |
215 | |
216 for (i = 0; i < 4; ++i) | |
217 VIM_CLEAR(wp->w_border_highlight[i]); | |
218 di = dict_find(dict, (char_u *)"borderhighlight", -1); | |
219 if (di != NULL) | |
220 { | |
221 if (di->di_tv.v_type != VAR_LIST) | |
222 emsg(_(e_listreq)); | |
223 else | |
224 { | |
225 list_T *list = di->di_tv.vval.v_list; | |
226 listitem_T *li; | |
227 | |
228 if (list != NULL) | |
229 for (i = 0, li = list->lv_first; i < 4 && i < list->lv_len; | |
230 ++i, li = li->li_next) | |
231 { | |
232 str = tv_get_string(&li->li_tv); | |
233 if (*str != NUL) | |
234 wp->w_border_highlight[i] = vim_strsave(str); | |
235 } | |
236 if (list->lv_len == 1 && wp->w_border_highlight[0] != NULL) | |
237 for (i = 1; i < 4; ++i) | |
238 wp->w_border_highlight[i] = | |
239 vim_strsave(wp->w_border_highlight[0]); | |
240 } | |
241 } | |
242 | |
243 for (i = 0; i < 8; ++i) | |
244 wp->w_border_char[i] = 0; | |
245 di = dict_find(dict, (char_u *)"borderchars", -1); | |
246 if (di != NULL) | |
247 { | |
248 if (di->di_tv.v_type != VAR_LIST) | |
249 emsg(_(e_listreq)); | |
250 else | |
251 { | |
252 list_T *list = di->di_tv.vval.v_list; | |
253 listitem_T *li; | |
254 | |
255 if (list != NULL) | |
256 for (i = 0, li = list->lv_first; i < 8 && i < list->lv_len; | |
257 ++i, li = li->li_next) | |
258 { | |
259 str = tv_get_string(&li->li_tv); | |
260 if (*str != NUL) | |
261 wp->w_border_char[i] = mb_ptr2char(str); | |
262 } | |
263 if (list->lv_len == 1) | |
264 for (i = 1; i < 8; ++i) | |
265 wp->w_border_char[i] = wp->w_border_char[0]; | |
266 if (list->lv_len == 2) | |
267 { | |
268 for (i = 4; i < 8; ++i) | |
269 wp->w_border_char[i] = wp->w_border_char[1]; | |
270 for (i = 1; i < 4; ++i) | |
271 wp->w_border_char[i] = wp->w_border_char[0]; | |
272 } | |
273 } | |
274 } | |
214 } | 275 } |
215 | 276 |
216 /* | 277 /* |
217 * Add lines to the popup from a list of strings. | 278 * Add lines to the popup from a list of strings. |
218 */ | 279 */ |