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 | |
parent | f4fd7ecbc025e8022c3fbfe52bc512b907cb5459 (diff) |
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')
-rw-r--r-- | src/ex_cmds.c | 4 | ||||
-rw-r--r-- | src/fileio.c | 3 | ||||
-rw-r--r-- | src/popupwin.c | 37 | ||||
-rw-r--r-- | src/proto/popupwin.pro | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_previewpopup_1.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_previewpopup_2.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_previewpopup_3.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_previewpopup_4.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_popupwin_previewpopup_5.dump | 14 | ||||
-rw-r--r-- | src/version.c | 2 |
10 files changed, 66 insertions, 4 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 57c98ae929..f79f054ec5 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3172,6 +3172,10 @@ do_ecmd( #ifdef FEAT_TITLE maketitle(); #endif +#ifdef FEAT_TEXT_PROP + if (popup_is_popup(curwin) && curwin->w_p_pvw) + popup_set_title(curwin); +#endif } #ifdef FEAT_DIFF diff --git a/src/fileio.c b/src/fileio.c index 1bf4d87607..bc0b15b914 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -6101,6 +6101,9 @@ shorten_fnames(int force) } status_redraw_all(); redraw_tabline = TRUE; +#ifdef FEAT_TEXT_PROP + popup_update_preview_title(); +#endif } #if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ diff --git a/src/popupwin.c b/src/popupwin.c index 9a39693d0a..4ca6d9fdf1 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 diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro index 63ff37aaf0..b964fc0dd0 100644 --- a/src/proto/popupwin.pro +++ b/src/proto/popupwin.pro @@ -47,4 +47,6 @@ void f_popup_getpreview(typval_T *argvars, typval_T *rettv); int popup_is_popup(win_T *wp); int popup_create_preview_window(void); void popup_close_preview(void); +void popup_set_title(win_T *wp); +void popup_update_preview_title(void); /* vim: set ft=c : */ diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_1.dump b/src/testdir/dumps/Test_popupwin_previewpopup_1.dump index 1b8729233e..f5ca4be2f0 100644 --- a/src/testdir/dumps/Test_popupwin_previewpopup_1.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_1.dump @@ -1,5 +1,5 @@ |o+0&#ffffff0|n|e| @71 -|t|w|o| @1|╔+0#0000001#ffd7ff255|═@40|X| +0#0000000#ffffff0@26 +|t|w|o| @1|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X| +0#0000000#ffffff0@26 |t|h|r|e@1|║+0#0000001#ffd7ff255|2|0| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26 |f|o|u|r| |║+0#0000001#ffd7ff255|t|h|e|w|o|r|d| |i|s| |h|e|r|e| @24| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26 |f|i|v|e| |║+0#0000001#ffd7ff255|2@1| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@26 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_2.dump b/src/testdir/dumps/Test_popupwin_previewpopup_2.dump index 131eabe81b..5192b31d42 100644 --- a/src/testdir/dumps/Test_popupwin_previewpopup_2.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_2.dump @@ -1,7 +1,7 @@ |o+0&#ffffff0|n|e| @71 |t|w|o| @71 |t|h|r|e@1| @69 -|f|o|u|r| @3|╔+0#0000001#ffd7ff255|═@40|X| +0#0000000#ffffff0@23 +|f|o|u|r| @3|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X| +0#0000000#ffffff0@23 |f|i|v|e| @3|║+0#0000001#ffd7ff255|2|7| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23 |s|i|x| @4|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23 |s|e|v|e|n| @2|║+0#0000001#ffd7ff255|2|9| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@23 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_3.dump b/src/testdir/dumps/Test_popupwin_previewpopup_3.dump index 46a3a61834..9958fdd47c 100644 --- a/src/testdir/dumps/Test_popupwin_previewpopup_3.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_3.dump @@ -1,7 +1,7 @@ |o+0&#ffffff0|n|e| @71 |t|w|o| @71 |t|h|r|e@1| @69 -|f|o|u|r| @9|╔+0#0000001#ffd7ff255|═@40|X| +0#0000000#ffffff0@17 +|f|o|u|r| @9|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X| +0#0000000#ffffff0@17 |f|i|v|e| @9|║+0#0000001#ffd7ff255|2|7| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17 |s|i|x| @10|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17 |s|e|v|e|n| @8|║+0#0000001#ffd7ff255|2|9| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@17 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_4.dump b/src/testdir/dumps/Test_popupwin_previewpopup_4.dump index de67fa39af..fa973e7245 100644 --- a/src/testdir/dumps/Test_popupwin_previewpopup_4.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_4.dump @@ -2,7 +2,7 @@ |t|w|o| @71 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @27|╔+0#0000001#ffd7ff255|═@40|X +|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X |s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|2|7| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 |s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 |f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|2|9| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_5.dump b/src/testdir/dumps/Test_popupwin_previewpopup_5.dump new file mode 100644 index 0000000000..4932a07425 --- /dev/null +++ b/src/testdir/dumps/Test_popupwin_previewpopup_5.dump @@ -0,0 +1,14 @@ +|o+0&#ffffff0|n|e| @71 +|t|w|o| @71 +|t|h|r|e@1| @69 +|f|o|u|r| @70 +|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |t|e|s|t|d|i|r|/|X|t|a|g|f|i|l|e| |═@22|X +|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|2|7| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|2|9| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|3|0| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲ +|v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 +|~+0#4040ff13&| @73 +|~| @73 +|:+0#0000000&| @55|1@1|,|3|9| @8|A|l@1| diff --git a/src/version.c b/src/version.c index edb770cfe8..723a1c152e 100644 --- a/src/version.c +++ b/src/version.c @@ -774,6 +774,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1789, +/**/ 1788, /**/ 1787, |