Hi All,

I have noticed that vim can do expansion of named directories that are defined 
in zsh, but this expansion fails if the resulting path contains spaces.  This 
can be tested by creating a new directory "$HOME/a b" and adding the following 
line to ~/.zshenv

hash -d abc="$HOME/a b"

When vim is started as "SHELL=/bin/zsh vim"

:echo expand('~abc')

produces

/home/user/a
b

Vim expands ~abc by running "print -N ~abc > tmpfile" in the shell (which 
writes NUL to the end of tmpfile), but when checking for separator, it would 
not detect NUL at the last position.  The attached patch seems to fix that.

Hope this helps,

Pavol

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
# HG changeset patch
# User Pavol Juhas <[email protected]>
# Date 1386626001 18000
# Node ID d9dc193a01941584773f3a0a889e8b1cf4162291
# Parent  79df7d17b859fe0c222dfd9c7db3d0f8e6a126f1
Fix NUL detection when zsh is used for tilde expansion.

The zsh command "print -N ~FooBar > tmpfile" writes single NUL character
at the end of tmpfile, but the previous code cannot find NUL at the
last position.

diff -r 79df7d17b859 -r d9dc193a0194 src/os_unix.c
--- a/src/os_unix.c	Sat Dec 07 14:48:10 2013 +0100
+++ b/src/os_unix.c	Mon Dec 09 16:53:21 2013 -0500
@@ -5990,7 +5990,7 @@
 	{
 	    /* If there is a NUL, set did_find_nul, else set check_spaces */
 	    buffer[len] = NUL;
-	    if (len && (int)STRLEN(buffer) < (int)len - 1)
+	    if (len && (int)STRLEN(buffer) < (int)len)
 		did_find_nul = TRUE;
 	    else
 		check_spaces = TRUE;

Raspunde prin e-mail lui