-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command line -c "normal..." stays in normal mode for subsequent -c commands #670
Comments
tplunket wrote:
Isn't this a problem with the quoting of the argument? ARTHUR: You are indeed brave Sir knight, but the fight is mine. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \ |
(For the record: I'm calling the Vim executable directly in the below commands rather than using the vim.bat helper script.) It seems as though Vim is doing something incorrect with the quote. Escaping a double quote inside a quoted string only requires doubling it:
Again, this batch file worked fine with the package in the gvim74.exe installer that's on vim.org, and it does not work with the gvim74-1024.exe installed app. If I run this command:
then I get the error:
We can see here clearly that it's trying to execute the entire line after the quote, but that the quote was passed through correctly. The most stripped down command line that causes this error is
(If I remove the execute bit I don't get the error but Vim remains running.) And just as a test to see if the shell is in fact separating the arguments the way we think it should,
All of these tests run with the executable installed by the vim74.exe installer and work correctly. This is a new failure, a regression since its release. |
I spent some time looking at the code but it quickly became apparent that I'll need to step through it to see what's going on. However I was struck by the thought that maybe something was doing quote processing inside of vim so I tried to double my This works as expected in 7.4.0 and fails with an error in 7.4.1023:
The error in .1023 is:
So it's munching an additional quote mark for some reason. Again, Python shows that the arguments are passed as desired by the shell:
|
I think 7.4.432 is the cause of this difference. Before 7.4.432, the command line was parsed differently when using gvim.exe or So the current quotation behavior is based on If you want to pass a double quotation inside a pair of double quotations,
BTW, it is not well documented that how the More detail by my analysis:
E.g.:
|
Thanks, @k-takata, for researching this. It was previously safe to send quotes through the vim.bat helper script that gets installed but with the change to command line processing now it seems the command processor gets tripped up by the escaping that CommandLineToArgvW requires/expects. It would appear, then, that if someone uses quotes that they cannot use them through those helper scripts, they have to have the exe on their path. |
Ken Takata wrote:
Thanks, I'll add that to the help. The fastest way to get an engineer to solve a problem is to declare that the /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \ |
I use this little batch file for sticking my company's SVN commit template onto the clipboard:
This works in the gvim74.exe installation and fails for the gvim74-1024.exe installation. It appears as though normal mode persists beyond the
-c
argument because if I change it to-c hello
(so it's obvious what's going on) and remove the-R
the editor starts up and I'm left with this in the buffer:The
-c hello
is interpreted as a continuation of the normal mode command.The text was updated successfully, but these errors were encountered: