• R/O
  • SSH

vim: 提交

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

修订版995f5e061e276cd5c24804656dc55da25a10b362 (tree)
时间2020-09-26 07:00:04
作者Bram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1743: cannot build without the eval feature

Commit: https://github.com/vim/vim/commit/273af497cac345897cf6369baa87a070876a5815
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 25 23:49:01 2020 +0200

patch 8.2.1743: cannot build without the eval feature
Problem: Cannot build without the eval feature.
Solution: Move shorten_dir outside of #ifdef.

更改概述

差异

diff -r 8d9d6be4de03 -r 995f5e061e27 src/filepath.c
--- a/src/filepath.c Fri Sep 25 23:15:04 2020 +0200
+++ b/src/filepath.c Sat Sep 26 00:00:04 2020 +0200
@@ -710,6 +710,69 @@
710710 return valid;
711711 }
712712
713+/*
714+ * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
715+ * "trim_len" specifies how many characters to keep for each directory.
716+ * Must be 1 or more.
717+ * It's done in-place.
718+ */
719+ static void
720+shorten_dir_len(char_u *str, int trim_len)
721+{
722+ char_u *tail, *s, *d;
723+ int skip = FALSE;
724+ int dirchunk_len = 0;
725+
726+ tail = gettail(str);
727+ d = str;
728+ for (s = str; ; ++s)
729+ {
730+ if (s >= tail) // copy the whole tail
731+ {
732+ *d++ = *s;
733+ if (*s == NUL)
734+ break;
735+ }
736+ else if (vim_ispathsep(*s)) // copy '/' and next char
737+ {
738+ *d++ = *s;
739+ skip = FALSE;
740+ dirchunk_len = 0;
741+ }
742+ else if (!skip)
743+ {
744+ *d++ = *s; // copy next char
745+ if (*s != '~' && *s != '.') // and leading "~" and "."
746+ {
747+ ++dirchunk_len; // only count word chars for the size
748+
749+ // keep copying chars until we have our preferred length (or
750+ // until the above if/else branches move us along)
751+ if (dirchunk_len >= trim_len)
752+ skip = TRUE;
753+ }
754+
755+ if (has_mbyte)
756+ {
757+ int l = mb_ptr2len(s);
758+
759+ while (--l > 0)
760+ *d++ = *++s;
761+ }
762+ }
763+ }
764+}
765+
766+/*
767+ * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
768+ * It's done in-place.
769+ */
770+ void
771+shorten_dir(char_u *str)
772+{
773+ shorten_dir_len(str, 1);
774+}
775+
713776 #if defined(FEAT_EVAL) || defined(PROTO)
714777
715778 /*
@@ -1352,69 +1415,6 @@
13521415 }
13531416
13541417 /*
1355- * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
1356- * "trim_len" specifies how many characters to keep for each directory.
1357- * Must be 1 or more.
1358- * It's done in-place.
1359- */
1360- static void
1361-shorten_dir_len(char_u *str, int trim_len)
1362-{
1363- char_u *tail, *s, *d;
1364- int skip = FALSE;
1365- int dirchunk_len = 0;
1366-
1367- tail = gettail(str);
1368- d = str;
1369- for (s = str; ; ++s)
1370- {
1371- if (s >= tail) // copy the whole tail
1372- {
1373- *d++ = *s;
1374- if (*s == NUL)
1375- break;
1376- }
1377- else if (vim_ispathsep(*s)) // copy '/' and next char
1378- {
1379- *d++ = *s;
1380- skip = FALSE;
1381- dirchunk_len = 0;
1382- }
1383- else if (!skip)
1384- {
1385- *d++ = *s; // copy next char
1386- if (*s != '~' && *s != '.') // and leading "~" and "."
1387- {
1388- ++dirchunk_len; // only count word chars for the size
1389-
1390- // keep copying chars until we have our preferred length (or
1391- // until the above if/else branches move us along)
1392- if (dirchunk_len >= trim_len)
1393- skip = TRUE;
1394- }
1395-
1396- if (has_mbyte)
1397- {
1398- int l = mb_ptr2len(s);
1399-
1400- while (--l > 0)
1401- *d++ = *++s;
1402- }
1403- }
1404- }
1405-}
1406-
1407-/*
1408- * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
1409- * It's done in-place.
1410- */
1411- void
1412-shorten_dir(char_u *str)
1413-{
1414- shorten_dir_len(str, 1);
1415-}
1416-
1417-/*
14181418 * "pathshorten()" function
14191419 */
14201420 void
diff -r 8d9d6be4de03 -r 995f5e061e27 src/version.c
--- a/src/version.c Fri Sep 25 23:15:04 2020 +0200
+++ b/src/version.c Sat Sep 26 00:00:04 2020 +0200
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 1743,
755+/**/
754756 1742,
755757 /**/
756758 1741,
Show on old repository browser