Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:9388140
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff -r 10d35c8b50e3 src/window.c
--- a/src/window.c Mon Feb 24 03:32:00 2014 +0100
+++ b/src/window.c Mon Mar 10 10:11:15 2014 +0900
@@ -6093,6 +6093,9 @@
{
char_u *ptr;
int len;
+#ifdef _WIN32
+ int maybe_path = FALSE;
+#endif
/*
* search forward for what could be the start of a file name
@@ -6130,20 +6133,59 @@
* Also allow "://" when ':' is not in 'isfname'.
*/
len = 0;
+#ifdef _WIN32
+ /* Maybe it's a path. So if found ':' in next, it's an end of the
+ * path string. This should work as below:
+ *
+ * http://www.google.com/ => HTML content(OK)
+ * http:/asdf => E447 Can't find file "http:/asdf" (OK)
+ * http:/asdf/ => E447 Can't find file "http:/asdf/" (OK)
+ * file:c:/vim/src/ => E447: Can't find file "file:c:/vim/src/" in path
+ * file:/c:/vim/src/ => E447: Can't find file "file:/c:/vim/src/" in path
+ * file://c:/vim/src/ => Open the directory(OK)
+ * p:/asdf => E447 Can't find file "p:/asdf" (OK)
+ * p:/asdf/ => E447 Can't find file "p:/asdf/" (OK)
+ * _:/asdf/ => E447 Can't find file "_:/asdf/" (OK)
+ * _:asdf/ => E447 Can't find file "_:asdf/" (OK)
+ * :asdf/ => E447 Can't find file ":asdf/" (OK)
+ * c:/vim/src/gui_w48.c:1228: => Open the file(OK)
+ * c:/vim/src/gui_w48.c:1925: => Open the file(OK)
+ * ../../../vim/src/gui_w48.c:1925: => Open the file(OK)
+ * :::foo::: => E447 Can't find file ":::foo:::" (OK)
+ */
+ if (isalpha(ptr[0]) && ptr[1] == ':')
+ {
+ maybe_path = TRUE;
+ len = 2;
+ } else if (ptr[0] == '.')
+ maybe_path = TRUE;
+#endif
while (vim_isfilec(ptr[len])
|| ((options & FNAME_HYP) && path_is_url(ptr + len)))
+ {
+#ifdef _WIN32
+ if (maybe_path && ptr[len] == ':')
+ break;
+#endif
#ifdef FEAT_MBYTE
if (has_mbyte)
len += (*mb_ptr2len)(ptr + len);
else
#endif
++len;
+ }
/*
* If there is trailing punctuation, remove it.
* But don't remove "..", could be a directory name.
*/
- if (len > 2 && vim_strchr((char_u *)".,:;!", ptr[len - 1]) != NULL
+ if (
+#ifdef _WIN32
+ /* ":::foo:::" should be handled name of buffer as what we can see. */
+ maybe_path &&
+#endif
+ len > 2
+ && vim_strchr((char_u *)".,:;!", ptr[len - 1]) != NULL
&& ptr[len - 2] != '.')
--len;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.