mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.0.0768: terminal window status shows "[Scratch]"
Problem: Terminal window status shows "[Scratch]". Solution: Show "[Terminal]" when no title was set. (Yasuhiro Matsumoto) Store the terminal title that vterm sends and use it. Update the special buffer name. (closes #1869)
This commit is contained in:
64
src/buffer.c
64
src/buffer.c
@@ -3626,6 +3626,13 @@ maketitle(void)
|
||||
#define SPACE_FOR_ARGNR (IOSIZE - 10) /* at least room for " - VIM" */
|
||||
if (curbuf->b_fname == NULL)
|
||||
vim_strncpy(buf, (char_u *)_("[No Name]"), SPACE_FOR_FNAME);
|
||||
#ifdef FEAT_TERMINAL
|
||||
else if (curbuf->b_term != NULL)
|
||||
{
|
||||
vim_strncpy(buf, term_get_status_text(curbuf->b_term),
|
||||
SPACE_FOR_FNAME);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
p = transstr(gettail(curbuf->b_fname));
|
||||
@@ -3633,20 +3640,27 @@ maketitle(void)
|
||||
vim_free(p);
|
||||
}
|
||||
|
||||
switch (bufIsChanged(curbuf)
|
||||
+ (curbuf->b_p_ro * 2)
|
||||
+ (!curbuf->b_p_ma * 4))
|
||||
{
|
||||
case 1: STRCAT(buf, " +"); break;
|
||||
case 2: STRCAT(buf, " ="); break;
|
||||
case 3: STRCAT(buf, " =+"); break;
|
||||
case 4:
|
||||
case 6: STRCAT(buf, " -"); break;
|
||||
case 5:
|
||||
case 7: STRCAT(buf, " -+"); break;
|
||||
}
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (curbuf->b_term == NULL)
|
||||
#endif
|
||||
switch (bufIsChanged(curbuf)
|
||||
+ (curbuf->b_p_ro * 2)
|
||||
+ (!curbuf->b_p_ma * 4))
|
||||
{
|
||||
case 1: STRCAT(buf, " +"); break;
|
||||
case 2: STRCAT(buf, " ="); break;
|
||||
case 3: STRCAT(buf, " =+"); break;
|
||||
case 4:
|
||||
case 6: STRCAT(buf, " -"); break;
|
||||
case 5:
|
||||
case 7: STRCAT(buf, " -+"); break;
|
||||
}
|
||||
|
||||
if (curbuf->b_fname != NULL)
|
||||
if (curbuf->b_fname != NULL
|
||||
#ifdef FEAT_TERMINAL
|
||||
&& curbuf->b_term == NULL
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* Get path of file, replace home dir with ~ */
|
||||
off = (int)STRLEN(buf);
|
||||
@@ -3663,18 +3677,8 @@ maketitle(void)
|
||||
p = gettail_sep(buf + off);
|
||||
if (p == buf + off)
|
||||
{
|
||||
char *txt;
|
||||
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (curbuf->b_term != NULL)
|
||||
txt = term_job_running(curbuf)
|
||||
? _("running") : _("finished");
|
||||
else
|
||||
#endif
|
||||
txt = _("help");
|
||||
|
||||
/* must be a help or terminal buffer */
|
||||
vim_strncpy(buf + off, (char_u *)txt,
|
||||
/* must be a help buffer */
|
||||
vim_strncpy(buf + off, (char_u *)_("help"),
|
||||
(size_t)(SPACE_FOR_DIR - off - 1));
|
||||
}
|
||||
else
|
||||
@@ -5670,16 +5674,20 @@ buf_spname(buf_T *buf)
|
||||
return (char_u *)_(msg_qflist);
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_QUICKFIX
|
||||
|
||||
/* There is no _file_ when 'buftype' is "nofile", b_sfname
|
||||
* contains the name as specified by the user */
|
||||
* contains the name as specified by the user. */
|
||||
if (bt_nofile(buf))
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (buf->b_term != NULL)
|
||||
return term_get_status_text(buf->b_term);
|
||||
#endif
|
||||
if (buf->b_sfname != NULL)
|
||||
return buf->b_sfname;
|
||||
return (char_u *)_("[Scratch]");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (buf->b_fname == NULL)
|
||||
return (char_u *)_("[No Name]");
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user