On Sat, Sep 06, 2008 at 04:56:25PM +0200, Bram Moolenaar wrote:
> Patch 7.2.010
> Problem:    When using "K" in Visual mode not all characters are properly
>           escaped. (Ben Schmidt)
> Solution:   Use a function with the functionality of shellescape(). (Jan
>           Minar)
> Files:            src/mbyte.c, src/misc2.c, src/normal.c

This ended up breaking the functionality of K all together.  The entire
line, starting from the beginning of the word under the cursor, is used
in the command instead of just the word itself.  This can be verified by
placing the cursor on the word popen in the following line and pressing
K.

  FILE *popen(const char *command, const char *type);

The attached patch fixes the problem.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]>
diff --git a/src/normal.c b/src/normal.c
index c1e630a..785de7c 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5519,8 +5519,11 @@ nv_ident(cap)
      */
     if (cmdchar == 'K' && !kp_help)
     {
+	/* Use only the chars in the identifier, instead of the whole line */
+	char_u s[n+1];
+	vim_strncpy(s, ptr, n);
 	/* Escape the argument properly for a shell command */
-	p = vim_strsave_shellescape(ptr, TRUE);
+	p = vim_strsave_shellescape(s, TRUE);
 	if (p == NULL)
 	{
 	    vim_free(buf);

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui