Mercurial > vim
comparison src/popupwin.c @ 17817:e8a7029efa40 v8.1.1905
patch 8.1.1905: cannot set all properties of the info popup
Commit: https://github.com/vim/vim/commit/c7c5f10a36fdeea353e026da28526ff9fb35e367
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 21 18:31:03 2019 +0200
patch 8.1.1905: cannot set all properties of the info popup
Problem: Cannot set all properties of the info popup.
Solution: Add popup_findinfo(). Rename popup_getpreview() to
popup_findpreview().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Aug 2019 18:45:04 +0200 |
parents | 9ec2526c04c5 |
children | fe92aaf166c1 |
comparison
equal
deleted
inserted
replaced
17816:2ddc513cd1ab | 17817:e8a7029efa40 |
---|---|
2056 | 2056 |
2057 if (wp != NULL) | 2057 if (wp != NULL) |
2058 popup_close_and_callback(wp, &argvars[1]); | 2058 popup_close_and_callback(wp, &argvars[1]); |
2059 } | 2059 } |
2060 | 2060 |
2061 /* | 2061 static void |
2062 * popup_hide({id}) | 2062 popup_hide(win_T *wp) |
2063 */ | 2063 { |
2064 void | 2064 if ((wp->w_popup_flags & POPF_HIDDEN) == 0) |
2065 f_popup_hide(typval_T *argvars, typval_T *rettv UNUSED) | |
2066 { | |
2067 int id = (int)tv_get_number(argvars); | |
2068 win_T *wp = find_popup_win(id); | |
2069 | |
2070 if (wp != NULL && (wp->w_popup_flags & POPF_HIDDEN) == 0) | |
2071 { | 2065 { |
2072 wp->w_popup_flags |= POPF_HIDDEN; | 2066 wp->w_popup_flags |= POPF_HIDDEN; |
2073 --wp->w_buffer->b_nwindows; | 2067 --wp->w_buffer->b_nwindows; |
2074 redraw_all_later(NOT_VALID); | 2068 redraw_all_later(NOT_VALID); |
2075 popup_mask_refresh = TRUE; | 2069 popup_mask_refresh = TRUE; |
2076 } | 2070 } |
2077 } | 2071 } |
2078 | 2072 |
2079 /* | 2073 /* |
2080 * popup_show({id}) | 2074 * popup_hide({id}) |
2081 */ | 2075 */ |
2082 void | 2076 void |
2083 f_popup_show(typval_T *argvars, typval_T *rettv UNUSED) | 2077 f_popup_hide(typval_T *argvars, typval_T *rettv UNUSED) |
2084 { | 2078 { |
2085 int id = (int)tv_get_number(argvars); | 2079 int id = (int)tv_get_number(argvars); |
2086 win_T *wp = find_popup_win(id); | 2080 win_T *wp = find_popup_win(id); |
2087 | 2081 |
2088 if (wp != NULL && (wp->w_popup_flags & POPF_HIDDEN) != 0) | 2082 if (wp != NULL) |
2083 popup_hide(wp); | |
2084 } | |
2085 | |
2086 void | |
2087 popup_show(win_T *wp) | |
2088 { | |
2089 if ((wp->w_popup_flags & POPF_HIDDEN) != 0) | |
2089 { | 2090 { |
2090 wp->w_popup_flags &= ~POPF_HIDDEN; | 2091 wp->w_popup_flags &= ~POPF_HIDDEN; |
2091 ++wp->w_buffer->b_nwindows; | 2092 ++wp->w_buffer->b_nwindows; |
2092 redraw_all_later(NOT_VALID); | 2093 redraw_all_later(NOT_VALID); |
2093 popup_mask_refresh = TRUE; | 2094 popup_mask_refresh = TRUE; |
2094 } | 2095 } |
2096 } | |
2097 | |
2098 /* | |
2099 * popup_show({id}) | |
2100 */ | |
2101 void | |
2102 f_popup_show(typval_T *argvars, typval_T *rettv UNUSED) | |
2103 { | |
2104 int id = (int)tv_get_number(argvars); | |
2105 win_T *wp = find_popup_win(id); | |
2106 | |
2107 if (wp != NULL) | |
2108 popup_show(wp); | |
2095 } | 2109 } |
2096 | 2110 |
2097 /* | 2111 /* |
2098 * popup_settext({id}, {text}) | 2112 * popup_settext({id}, {text}) |
2099 */ | 2113 */ |
3312 return NULL; | 3326 return NULL; |
3313 } | 3327 } |
3314 #endif | 3328 #endif |
3315 | 3329 |
3316 void | 3330 void |
3317 f_popup_getpreview(typval_T *argvars UNUSED, typval_T *rettv) | 3331 f_popup_findinfo(typval_T *argvars UNUSED, typval_T *rettv) |
3332 { | |
3333 win_T *wp = popup_find_info_window(); | |
3334 | |
3335 rettv->vval.v_number = wp == NULL ? 0 : wp->w_id; | |
3336 } | |
3337 | |
3338 void | |
3339 f_popup_findpreview(typval_T *argvars UNUSED, typval_T *rettv) | |
3318 { | 3340 { |
3319 win_T *wp = popup_find_preview_window(); | 3341 win_T *wp = popup_find_preview_window(); |
3320 | 3342 |
3321 rettv->vval.v_number = wp == NULL ? 0 : wp->w_id; | 3343 rettv->vval.v_number = wp == NULL ? 0 : wp->w_id; |
3322 } | 3344 } |
3353 win_enter(wp, FALSE); | 3375 win_enter(wp, FALSE); |
3354 return OK; | 3376 return OK; |
3355 } | 3377 } |
3356 | 3378 |
3357 #if defined(FEAT_QUICKFIX) || defined(PROTO) | 3379 #if defined(FEAT_QUICKFIX) || defined(PROTO) |
3358 void | 3380 /* |
3359 popup_close_preview(int info) | 3381 * Close any preview popup. |
3360 { | 3382 */ |
3361 win_T *wp = info ? popup_find_info_window() : popup_find_preview_window(); | 3383 void |
3384 popup_close_preview(void) | |
3385 { | |
3386 win_T *wp = popup_find_preview_window(); | |
3362 | 3387 |
3363 if (wp != NULL) | 3388 if (wp != NULL) |
3364 { | 3389 { |
3365 typval_T res; | 3390 typval_T res; |
3366 | 3391 |
3367 res.v_type = VAR_NUMBER; | 3392 res.v_type = VAR_NUMBER; |
3368 res.vval.v_number = -1; | 3393 res.vval.v_number = -1; |
3369 popup_close_and_callback(wp, &res); | 3394 popup_close_and_callback(wp, &res); |
3370 } | 3395 } |
3396 } | |
3397 | |
3398 /* | |
3399 * Hide the info popup. | |
3400 */ | |
3401 void | |
3402 popup_hide_info(void) | |
3403 { | |
3404 win_T *wp = popup_find_info_window(); | |
3405 | |
3406 if (wp != NULL) | |
3407 popup_hide(wp); | |
3371 } | 3408 } |
3372 #endif | 3409 #endif |
3373 | 3410 |
3374 /* | 3411 /* |
3375 * Set the title of the popup window to the file name. | 3412 * Set the title of the popup window to the file name. |