]> granicus.if.org Git - vim/commitdiff
patch 8.1.1789: cannot see file name of preview popup window v8.1.1789
authorBram Moolenaar <Bram@vim.org>
Thu, 1 Aug 2019 20:40:44 +0000 (22:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 1 Aug 2019 20:40:44 +0000 (22:40 +0200)
Problem:    Cannot see file name of preview popup window.
Solution:   Add the file name as the title.

src/ex_cmds.c
src/fileio.c
src/popupwin.c
src/proto/popupwin.pro
src/testdir/dumps/Test_popupwin_previewpopup_1.dump
src/testdir/dumps/Test_popupwin_previewpopup_2.dump
src/testdir/dumps/Test_popupwin_previewpopup_3.dump
src/testdir/dumps/Test_popupwin_previewpopup_4.dump
src/testdir/dumps/Test_popupwin_previewpopup_5.dump [new file with mode: 0644]
src/version.c

index 57c98ae92982827cab5d5fbe101a7470fbde7b43..f79f054ec50fb704d1ab6ba831c43f57f49e23ff 100644 (file)
@@ -3171,6 +3171,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
     }
 
index 1bf4d876073b3da973f6963692b8a3fabab2529f..bc0b15b91496f519a9ed27bda4920859cbb1b2fc 100644 (file)
@@ -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)) \
index 9a39693d0a8b98d76e9a163fc140e340bf982860..4ca6d9fdf1a4a80aa4db6d2f7882f7e07b3c3379 100644 (file)
@@ -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
index 63ff37aaf080ad1109af40021667e4dacf4b9d14..b964fc0dd02a921e711ddefb2aa8f27709db7388 100644 (file)
@@ -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 : */
index 1b8729233eb002672e17d1e312bdb09dd1bffd1d..f5ca4be2f0247259096b270ca6d8d9a81132d051 100644 (file)
@@ -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
index 131eabe81ba301b52a8359432f562b97f61f8436..5192b31d426b5af318fa7130775973240fa162e6 100644 (file)
@@ -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
index 46a3a618348696eeb34d3fe9b080e5a1e8acacae..9958fdd47c80a934951f0c10817fb847a0a441a6 100644 (file)
@@ -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
index de67fa39afa4c7b16e0fd60dc5ec23931c6e00f2..fa973e72457d711bb411618392d8de00c694bbe2 100644 (file)
@@ -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 (file)
index 0000000..4932a07
--- /dev/null
@@ -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| 
index edb770cfe8b179f98e16330f8f6e2a945fe2120b..723a1c152ef96bd99b35f84917abc9b8d3e033e6 100644 (file)
@@ -773,6 +773,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1789,
 /**/
     1788,
 /**/