sgur
9/9/2013 - 10:24 AM

gistfile1.diff

diff -r a00302b18c60 src/fileio.c
--- a/src/fileio.c Thu Sep 05 21:41:40 2013 +0200
+++ b/src/fileio.c	Mon Sep 09 19:29:55 2013 +0900
@@ -10410,7 +10410,12 @@
 		    reg_pat[i++] = *p++;
 		else
 # endif
-		if (allow_dirs != NULL && vim_ispathsep(*p))
+		if (allow_dirs != NULL && (
+			    vim_ispathsep(*p)
+# if defined(MSDOS) || defined(MSWIN) || defined(OS2)
+				|| *p == ':'
+#endif
+			))
 		    *allow_dirs = TRUE;
 		reg_pat[i++] = *p;
 		break;
diff -r a00302b18c60 src/memline.c
--- a/src/memline.c	Thu Sep 05 21:41:40 2013 +0200
+++ b/src/memline.c	Mon Sep 09 19:29:55 2013 +0900
@@ -4014,6 +4014,15 @@
     else
 	retval = concat_fnames(dname, tail, TRUE);
 
+#ifdef WIN3264
+    if (retval)
+    {
+	for (t = gettail(retval); *t != NUL; mb_ptr_adv(t))
+	    if (*t == ':')
+		*t = '%';
+    }
+#endif
+
     return retval;
 }
 
@@ -4142,6 +4151,19 @@
 		     && ((!defined(UNIX) && !defined(OS2)) || defined(ARCHIE))
 # define CREATE_DUMMY_FILE
     FILE	*dummyfd = NULL;
+    char_u	*buf_fname = buf->b_fname;
+
+#ifdef WIN3264
+    if (buf->b_fname != NULL && !mch_isFullName(buf->b_fname)
+	    && vim_strchr(buf->b_fname, ':'))
+    {
+	char *t;
+	buf_fname = (char *)vim_strsave(buf->b_fname);
+	for (t = gettail(buf_fname); *t != NUL; mb_ptr_adv(t))
+	    if (*t == ':')
+		*t = '%';
+    }
+#endif
 
     /*
      * If we start editing a new file, e.g. "test.doc", which resides on an
@@ -4150,9 +4172,9 @@
      * this problem we temporarily create "test.doc".  Don't do this when the
      * check below for a 8.3 file name is used.
      */
-    if (!(buf->b_p_sn || buf->b_shortname) && buf->b_fname != NULL
-					     && mch_getperm(buf->b_fname) < 0)
-	dummyfd = mch_fopen((char *)buf->b_fname, "w");
+    if (!(buf->b_p_sn || buf->b_shortname) && buf_fname != NULL
+					     && mch_getperm(buf_fname) < 0)
+	dummyfd = mch_fopen((char *)buf_fname, "w");
 #endif
 
     /*
@@ -4171,7 +4193,7 @@
     if (dir_name == NULL)	    /* out of memory */
 	fname = NULL;
     else
-	fname = makeswapname(buf->b_fname, buf->b_ffname, buf, dir_name);
+	fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name);
 
     for (;;)
     {
@@ -4204,7 +4226,7 @@
 	     * It either contains two dots, is longer than 8 chars, or starts
 	     * with a dot.
 	     */
-	    tail = gettail(buf->b_fname);
+	    tail = gettail(buf_fname);
 	    if (       vim_strchr(tail, '.') != NULL
 		    || STRLEN(tail) > (size_t)8
 		    || *gettail(fname) == '.')
@@ -4273,7 +4295,7 @@
 		    {
 			buf->b_shortname = TRUE;
 			vim_free(fname);
-			fname = makeswapname(buf->b_fname, buf->b_ffname,
+			fname = makeswapname(buf_fname, buf->b_ffname,
 							       buf, dir_name);
 			continue;	/* try again with b_shortname set */
 		    }
@@ -4344,7 +4366,7 @@
 		{
 		    buf->b_shortname = TRUE;
 		    vim_free(fname);
-		    fname = makeswapname(buf->b_fname, buf->b_ffname,
+		    fname = makeswapname(buf_fname, buf->b_ffname,
 							       buf, dir_name);
 		    continue;	    /* try again with '.' replaced with '_' */
 		}
@@ -4356,7 +4378,7 @@
 	     * viewing a help file or when the path of the file is different
 	     * (happens when all .swp files are in one directory).
 	     */
-	    if (!recoverymode && buf->b_fname != NULL
+	    if (!recoverymode && buf_fname != NULL
 				&& !buf->b_help && !(buf->b_flags & BF_DUMMY))
 	    {
 		int		fd;
@@ -4433,7 +4455,7 @@
 		    {
 			fclose(dummyfd);
 			dummyfd = NULL;
-			mch_remove(buf->b_fname);
+			mch_remove(buf_fname);
 			did_use_dummy = TRUE;
 		    }
 #endif
@@ -4448,7 +4470,7 @@
 		     * user anyway.
 		     */
 		    if (swap_exists_action != SEA_NONE
-			    && has_autocmd(EVENT_SWAPEXISTS, buf->b_fname, buf))
+			    && has_autocmd(EVENT_SWAPEXISTS, buf_fname, buf))
 			choice = do_swapexists(buf, fname);
 
 		    if (choice == 0)
@@ -4549,7 +4571,7 @@
 #ifdef CREATE_DUMMY_FILE
 		    /* Going to try another name, need the dummy file again. */
 		    if (did_use_dummy)
-			dummyfd = mch_fopen((char *)buf->b_fname, "w");
+			dummyfd = mch_fopen((char *)buf_fname, "w");
 #endif
 		}
 	    }
@@ -4581,9 +4603,13 @@
     if (dummyfd != NULL)	/* file has been created temporarily */
     {
 	fclose(dummyfd);
-	mch_remove(buf->b_fname);
+	mch_remove(buf_fname);
     }
 #endif
+#ifdef WIN3264
+    if (buf_fname != NULL && buf_fname != buf->b_fname)
+	vim_free(buf_fname);
+#endif
     return fname;
 }
 
diff -r a00302b18c60 src/misc1.c
--- a/src/misc1.c	Thu Sep 05 21:41:40 2013 +0200
+++ b/src/misc1.c	Mon Sep 09 19:29:55 2013 +0900
@@ -4800,7 +4800,7 @@
 
     if (fname == NULL)
 	return (char_u *)"";
-    for (p1 = p2 = fname; *p2; )	/* find last part of path */
+    for (p1 = p2 = get_past_head(fname); *p2; )	/* find last part of path */
     {
 	if (vim_ispathsep(*p2))
 	    p1 = p2 + 1;
@@ -4931,7 +4931,7 @@
     return (c == '/');	    /* UNIX has ':' inside file names */
 #else
 # ifdef BACKSLASH_IN_FILENAME
-    return (c == ':' || c == '/' || c == '\\');
+    return (c == '/' || c == '\\');
 # else
 #  ifdef VMS
     /* server"user passwd"::device:[full.path.name]fname.extension;version" */