diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-01 22:40:44 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-01 22:40:44 +0200 |
commit | 90f3e7ac56056ffad50bac9d4497b5830c37ab26 (patch) | |
tree | 5a787144818c26a791d8a0c5cfa5969483b67e29 /src/popupwin.c | |
parent | f4fd7ecbc025e8022c3fbfe52bc512b907cb5459 (diff) | |
download | vim-git-8.1.1789.tar.gz |
patch 8.1.1789: cannot see file name of preview popup windowv8.1.1789
Problem: Cannot see file name of preview popup window.
Solution: Add the file name as the title.
Diffstat (limited to 'src/popupwin.c')
-rw-r--r-- | src/popupwin.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/popupwin.c b/src/popupwin.c index 9a39693d0..4ca6d9fdf 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -3198,4 +3198,41 @@ popup_close_preview() } } +/* + * Set the title of the popup window to the file name. + */ + void +popup_set_title(win_T *wp) +{ + if (wp->w_buffer->b_fname != NULL) + { + char_u dirname[MAXPATHL]; + size_t len; + + mch_dirname(dirname, MAXPATHL); + shorten_buf_fname(wp->w_buffer, dirname, FALSE); + + vim_free(wp->w_popup_title); + len = STRLEN(wp->w_buffer->b_fname) + 3; + wp->w_popup_title = alloc((int)len); + if (wp->w_popup_title != NULL) + vim_snprintf((char *)wp->w_popup_title, len, " %s ", + wp->w_buffer->b_fname); + redraw_win_later(wp, VALID); + } +} + +/* + * If there is a preview window, update the title. + * Used after changing directory. + */ + void +popup_update_preview_title(void) +{ + win_T *wp = popup_find_preview_window(); + + if (wp != NULL) + popup_set_title(wp); +} + #endif // FEAT_TEXT_PROP |