Hi, guys.
I've posted on vim_use some days before:
>$ vim -c "q" 'foo ~ foo'
>$ vim -c "normal '0"
>E20: Mark not set
Filename contains '~' character which is around with path separators
(i.e. ' ' and ',') has such problem.
And the patch:
Index: mark.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/mark.c,v
retrieving revision 1.13
diff -u -p -r1.13 mark.c
--- mark.c 10 May 2007 16:48:03 -0000 1.13
+++ mark.c 24 Sep 2007 01:06:36 -0000
@@ -499,7 +499,8 @@ getnextmark(startpos, dir, begin_line)
fname2fnum(fm)
xfmark_T *fm;
{
- char_u *p;
+ char_u *p;
+ char_u *ep; /* escaped string pointer */
if (fm->fname != NULL)
{
@@ -507,7 +508,32 @@ fname2fnum(fm)
* First expand "~/" in the file name to the home directory.
* Try to shorten the file name.
*/
- expand_env(fm->fname, NameBuff, MAXPATHL);
+
+ int escaped = FALSE;
+ /* expand_env use ',' and ' ' as separators.
+ * if filename contains them, escape.
+ */
+ if (vim_strpbrk(fm->fname, ", ")) {
+ ep = vim_strsave_escaped(fm->fname, ", ");
+ escaped = True;
+ }
+ expand_env(ep, NameBuff, MAXPATHL);
+
+ /* Unescape ',' and ' ' should be save, since "\\, " are
+ * not valid in username
+ */
+ if ( escaped ) {
+
+ char_u *uep = NameBuff;
+ char_u *uend = uep + STRLEN(NameBuff);
+
+ while (*uep) {
+ if ( uep[0] == '\\' && ( uep[1] == ' ' || uep[1] == ',' ) )
+ mch_memmove(uep, uep + 1, uend - uep);
+ uep++;
+ }
+ }
+
mch_dirname(IObuff, IOSIZE);
p = shorten_fname(NameBuff, IObuff);
--
Dasn
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---