aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fileio.c42
-rw-r--r--src/fileio.h1
-rw-r--r--src/path.c42
-rw-r--r--src/path.h1
4 files changed, 43 insertions, 43 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 45ba8986d8..2341c6308d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4703,6 +4703,48 @@ static int make_bom(char_u *buf, char_u *name)
}
/*
+ * Shorten filenames for all buffers.
+ * 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_fnames(int force)
+{
+ char_u dirname[MAXPATHL];
+ buf_T *buf;
+ char_u *p;
+
+ os_dirname(dirname, MAXPATHL);
+ for (buf = firstbuf; buf != NULL; buf = buf->b_next) {
+ if (buf->b_fname != NULL
+ && !bt_nofile(buf)
+ && !path_with_url(buf->b_fname)
+ && (force
+ || buf->b_sfname == NULL
+ || os_is_absolute_path(buf->b_sfname))) {
+ vim_free(buf->b_sfname);
+ buf->b_sfname = NULL;
+ p = shorten_fname(buf->b_ffname, dirname);
+ if (p != NULL) {
+ buf->b_sfname = vim_strsave(p);
+ buf->b_fname = buf->b_sfname;
+ }
+ if (p == NULL || buf->b_fname == NULL)
+ buf->b_fname = buf->b_ffname;
+ }
+
+ /* Always make the swap file name a full path, a "nofile" buffer may
+ * also have a swap file. */
+ mf_fullname(buf->b_ml.ml_mfp);
+ }
+ status_redraw_all();
+ redraw_tabline = TRUE;
+}
+
+/*
* add extension to file name - change path/fo.o.h to path/fo.o.h.ext or
* fo_o_h.ext for MSDOS or when shortname option set.
*
diff --git a/src/fileio.h b/src/fileio.h
index ba776f0dba..ce04b53e1e 100644
--- a/src/fileio.h
+++ b/src/fileio.h
@@ -33,6 +33,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start,
int filtering);
void msg_add_fname(buf_T *buf, char_u *fname);
void msg_add_lines(int insert_space, long lnum, off_t nchars);
+void shorten_fnames(int force);
char_u *modname(char_u *fname, char_u *ext, int prepend_dot);
char_u *buf_modname(int shortname, char_u *fname, char_u *ext,
int prepend_dot);
diff --git a/src/path.c b/src/path.c
index acdd216c06..9f46dc4e12 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1833,48 +1833,6 @@ char_u *shorten_fname(char_u *full_path, char_u *dir_name)
return p;
}
-/*
- * Shorten filenames for all buffers.
- * 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_fnames(int force)
-{
- char_u dirname[MAXPATHL];
- buf_T *buf;
- char_u *p;
-
- os_dirname(dirname, MAXPATHL);
- for (buf = firstbuf; buf != NULL; buf = buf->b_next) {
- if (buf->b_fname != NULL
- && !bt_nofile(buf)
- && !path_with_url(buf->b_fname)
- && (force
- || buf->b_sfname == NULL
- || os_is_absolute_path(buf->b_sfname))) {
- vim_free(buf->b_sfname);
- buf->b_sfname = NULL;
- p = shorten_fname(buf->b_ffname, dirname);
- if (p != NULL) {
- buf->b_sfname = vim_strsave(p);
- buf->b_fname = buf->b_sfname;
- }
- if (p == NULL || buf->b_fname == NULL)
- buf->b_fname = buf->b_ffname;
- }
-
- /* Always make the swap file name a full path, a "nofile" buffer may
- * also have a swap file. */
- mf_fullname(buf->b_ml.ml_mfp);
- }
- status_redraw_all();
- redraw_tabline = TRUE;
-}
-
#if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \
|| defined(FEAT_GUI_MSWIN) \
|| defined(FEAT_GUI_MAC) \
diff --git a/src/path.h b/src/path.h
index c18ea59d13..834431e1bb 100644
--- a/src/path.h
+++ b/src/path.h
@@ -37,7 +37,6 @@ int pathcmp(const char *p, const char *q, int maxlen);
int mch_expandpath(garray_T *gap, char_u *path, int flags);
char_u *shorten_fname1(char_u *full_path);
char_u *shorten_fname(char_u *full_path, char_u *dir_name);
-void shorten_fnames(int force);
void shorten_filenames(char_u **fnames, int count);
int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file,
int flags);