octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MSVC 2.9.13 and path completion with spaces


From: John W. Eaton
Subject: Re: MSVC 2.9.13 and path completion with spaces
Date: Mon, 08 Oct 2007 14:03:38 -0400

On  7-Oct-2007, David Bateman wrote:

| Ok, here is my current version of this patch. What it does is add a set
| of characters that if they appear in a filename completion, the readline
| attempts to add a leading quote (if the string doesn't already have one)
| to the filename, It uses a single quote for the filename quoting with
| the idea that this is what should be used for raw commands, but respects
| any existing quoting with double quotes.
| 
| The function that is bound to the Return key is also changed to check if
| the returned string needs a terminating quote, and redisplay the string
| with any added quotes before calling the rl_newline function that is
| normally bound to the return character. This allows the user to type
| something like
| 
| cd C:\Doc<TAB><RETURN>
| 
| and get what you would expect to happen, happen. As mentioned if you
| want completion of sub-directories then a leading quote might need to be
| added, that is
| 
| cd DirOne/DirTw<TAB>
| 
| won't complete the directory name as expected, but
| 
| cd 'DirOne/DirTw<TAB>
| 
| will. Given that "/" and "\" have other meanings than a directory
| separation character in Octave, its hard to see how to do better in this
| case..

OK, I tested this patch lightly and it seems good.  So if you are
confident about it, please check it in for 2.9.15.

I haven't looked closely at the code so I don't know whether readline
makes this easy, but it seems that we should be able to look at the
current line and see that the symbol "DirOne" is only available as a
directory completion, not as some other symbol (like a function or
variable name) and so then automatically quote the completion.  It
looks like that should happen at the same time that the trailing
directory separator is added to the name (I think readline does that
part for us, correct?).  But unless you quickly see some really simple
way to make that happen, I would not worry about it.  Having
subdirectory completion work at all is a great improvement.

| I haven't tested this patch without readline to see what effect this
| will have, and so it might breaking building in that case. Is this an issue?

Octave should still build without readline (using the
--disable-readline configure parameter) but it doesn't need to do
anything for completion in that case.  I'm building this way now to
see if it will still build.

Thanks for working on this.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]