summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-25 23:49:01 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-25 23:49:01 +0200
commit273af497cac345897cf6369baa87a070876a5815 (patch)
tree283b9d233421eb78b41e0afa82e1dcfd6de79bb2
parent7e9210ea5320e0c3fd9fd93e3f3f1a59e029cf46 (diff)
downloadvim-git-273af497cac345897cf6369baa87a070876a5815.tar.gz
patch 8.2.1743: cannot build without the eval featurev8.2.1743
Problem: Cannot build without the eval feature. Solution: Move shorten_dir outside of #ifdef.
-rw-r--r--src/filepath.c126
-rw-r--r--src/version.c2
2 files changed, 65 insertions, 63 deletions
diff --git a/src/filepath.c b/src/filepath.c
index 197825db3..e2131a4b7 100644
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -710,6 +710,69 @@ repeat:
return valid;
}
+/*
+ * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
+ * "trim_len" specifies how many characters to keep for each directory.
+ * Must be 1 or more.
+ * It's done in-place.
+ */
+ static void
+shorten_dir_len(char_u *str, int trim_len)
+{
+ char_u *tail, *s, *d;
+ int skip = FALSE;
+ int dirchunk_len = 0;
+
+ tail = gettail(str);
+ d = str;
+ for (s = str; ; ++s)
+ {
+ if (s >= tail) // copy the whole tail
+ {
+ *d++ = *s;
+ if (*s == NUL)
+ break;
+ }
+ else if (vim_ispathsep(*s)) // copy '/' and next char
+ {
+ *d++ = *s;
+ skip = FALSE;
+ dirchunk_len = 0;
+ }
+ else if (!skip)
+ {
+ *d++ = *s; // copy next char
+ if (*s != '~' && *s != '.') // and leading "~" and "."
+ {
+ ++dirchunk_len; // only count word chars for the size
+
+ // keep copying chars until we have our preferred length (or
+ // until the above if/else branches move us along)
+ if (dirchunk_len >= trim_len)
+ skip = TRUE;
+ }
+
+ if (has_mbyte)
+ {
+ int l = mb_ptr2len(s);
+
+ while (--l > 0)
+ *d++ = *++s;
+ }
+ }
+ }
+}
+
+/*
+ * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
+ * It's done in-place.
+ */
+ void
+shorten_dir(char_u *str)
+{
+ shorten_dir_len(str, 1);
+}
+
#if defined(FEAT_EVAL) || defined(PROTO)
/*
@@ -1352,69 +1415,6 @@ f_mkdir(typval_T *argvars, typval_T *rettv)
}
/*
- * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
- * "trim_len" specifies how many characters to keep for each directory.
- * Must be 1 or more.
- * It's done in-place.
- */
- static void
-shorten_dir_len(char_u *str, int trim_len)
-{
- char_u *tail, *s, *d;
- int skip = FALSE;
- int dirchunk_len = 0;
-
- tail = gettail(str);
- d = str;
- for (s = str; ; ++s)
- {
- if (s >= tail) // copy the whole tail
- {
- *d++ = *s;
- if (*s == NUL)
- break;
- }
- else if (vim_ispathsep(*s)) // copy '/' and next char
- {
- *d++ = *s;
- skip = FALSE;
- dirchunk_len = 0;
- }
- else if (!skip)
- {
- *d++ = *s; // copy next char
- if (*s != '~' && *s != '.') // and leading "~" and "."
- {
- ++dirchunk_len; // only count word chars for the size
-
- // keep copying chars until we have our preferred length (or
- // until the above if/else branches move us along)
- if (dirchunk_len >= trim_len)
- skip = TRUE;
- }
-
- if (has_mbyte)
- {
- int l = mb_ptr2len(s);
-
- while (--l > 0)
- *d++ = *++s;
- }
- }
- }
-}
-
-/*
- * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
- * It's done in-place.
- */
- void
-shorten_dir(char_u *str)
-{
- shorten_dir_len(str, 1);
-}
-
-/*
* "pathshorten()" function
*/
void
diff --git a/src/version.c b/src/version.c
index 4983b1b6b..282c04ef9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1743,
+/**/
1742,
/**/
1741,