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: David Bateman
Subject: Re: MSVC 2.9.13 and path completion with spaces
Date: Wed, 03 Oct 2007 18:04:30 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On  3-Oct-2007, David Bateman wrote:
>
> | Thinking more about this I see no logical way of getting this to work
> | correctly with readline or rather with only the help of readline. How
> | would readline know to append a quote to the end of the string? Does it
> | do it for all filenames? What about if you want to go into a
> | subdirectory that is 2 or more levels below the current level?
> | 
> | I think a better solution might be to add a field
> | symbol_record:TYPE:COMMAND_EXPECTS_ONE_ARG enum and set it for Fcd and
> | Fls and perhaps others. Add the
> | 
> | bool
> | symbol_record::command_expects_one_arg ()
> | {
> |    return (symbol_type & symbol_record::COMMAND_EXPECTS_ONE_ARG);
> | }
> | 
> | method. Then in parse.y when constructing a word_list for a command
> | check if the command expects a single argument, and if so don't split
> | the elements of tree_argument_list which are of type octave_value_list
> | into multiple octave_value but rather keep a single string respecting
> | the white space...
>
> I'd prefer to avoid doing that.  Instead, I think we need to make
> quoting work with readline.  I haven't looked a the details, but bash
> can complete filenames with spaces when they are quoted.  For example,
> if there is a file called 'foo   bar', bash will complete it if it is
> typed
>
>   ls 'foo<TAB>
>
> or
>
>   ls "foo<TAB>
>
> and it will automatically insert the trailing quote.  You also have to
> be careful with completion of filenames that include quote characters.
> The bash code is in bashline.c in the bash sources.  We can't use
> exactly what is used in bash because the languages are different (we
> can't use \ for quoting spaces, for example) but I think it might be
> helpful to look at the code there anyway.
>
>   
I'm not sure what bash does to get all of this stuff to work except that
in bracecomp.c there is the comment

/* We handle quoting ourselves within hack_braces_completion, so we turn off
rl_filename_quoting_desired and rl_filename_quoting_function. */

So it appears that bash does the quoting and not readline.. I suppose we
could just copy their quoting code..

> Also, filename completion has been somewhat broken in Octave for a
> long time (for example, try to complete a filename that includes a
> directory separator character).  
Also sub directory fall into the same problem, and in fact if I have two
directories "Dir One" and "Dir Only" I get completion for "Dir On" but
then the space is treated as a word separation character by readline and
it tries to complete "On" and of course fails.. Yes the completion code
is rather broken. However, I was looking for a quick fix for the problem
of spaces in file or directory names to commands, so I was limiting the
scope of my fix..

> Maybe all of this could be fixed
> after 3.0?  Or, if you see some simple fixes that would improve
> things, we could do it now, but I'd rather not delay 3.0 for this
> issue since it is not a new regression.
>   
Well since most Windows users have their home directory under "Documents
and Settings" this is a bit of a pain for windows users, which is why I
was looking at it before a 3.0 release. I'll look at bash and see if
there are any ideas we can steal..

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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