aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/fileio.c19
-rw-r--r--src/nvim/quickfix.c19
2 files changed, 19 insertions, 19 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 494b557379..290de034d7 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -4311,15 +4311,13 @@ static int make_bom(char_u *buf, char_u *name)
return (int)(p - buf);
}
-/*
- * Shorten filename of a buffer.
- * When "force" is TRUE: Use full path from now on for files currently being
- * edited, both for file name and swap file name. Try to shorten the file
- * names a bit, if safe to do so.
- * When "force" is FALSE: Only try to shorten absolute file names.
- * For buffers that have buftype "nofile" or "scratch": never change the file
- * name.
- */
+/// Shorten filename of a buffer.
+/// When "force" is TRUE: Use full path from now on for files currently being
+/// edited, both for file name and swap file name. Try to shorten the file
+/// names a bit, if safe to do so.
+/// When "force" is FALSE: Only try to shorten absolute file names.
+/// For buffers that have buftype "nofile" or "scratch": never change the file
+/// name.
void shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
{
char_u *p;
@@ -4337,8 +4335,9 @@ void shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
buf->b_sfname = vim_strsave(p);
buf->b_fname = buf->b_sfname;
}
- if (p == NULL || buf->b_fname == NULL)
+ if (p == NULL || buf->b_fname == NULL) {
buf->b_fname = buf->b_ffname;
+ }
}
}
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index ab7e3ec6dd..7c555da1a0 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -2240,11 +2240,12 @@ void qf_list(exarg_T *eap)
}
}
- /* Shorten all the file names, so that it is easy to read */
- shorten_fnames(FALSE);
+ // Shorten all the file names, so that it is easy to read.
+ shorten_fnames(false);
- if (qi->qf_lists[qi->qf_curlist].qf_nonevalid)
- all = TRUE;
+ if (qi->qf_lists[qi->qf_curlist].qf_nonevalid) {
+ all = true;
+ }
qfp = qi->qf_lists[qi->qf_curlist].qf_start;
for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ) {
if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) {
@@ -2966,13 +2967,13 @@ static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last)
if (qfp->qf_type == 1) { // :helpgrep
STRLCPY(IObuff, path_tail(errbuf->b_fname), sizeof(IObuff));
} else {
- /* shorten the file name if not done already */
+ // shorten the file name if not done already
if (errbuf->b_sfname == NULL
- || path_is_absolute(errbuf->b_sfname))
- {
- if (*dirname == NUL)
+ || path_is_absolute(errbuf->b_sfname)) {
+ if (*dirname == NUL) {
os_dirname(dirname, MAXPATHL);
- shorten_buf_fname(errbuf, dirname, FALSE);
+ }
+ shorten_buf_fname(errbuf, dirname, false);
}
STRLCPY(IObuff, errbuf->b_fname, sizeof(IObuff));
}