Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14233

Re: [PATCH] Add nofirstword completion option

From Luca Boccassi <bluca@debian.org>
Newsgroups gnu.bash.bug
Subject Re: [PATCH] Add nofirstword completion option
Date 2018-06-12 18:28 +0100
Message-ID <mailman.1760.1528824548.1292.bug-bash@gnu.org> (permalink)
References (7 earlier) <3a98f6c5-0f1e-54aa-491c-da7100430ce8@case.edu> <1527605096.6997.27.camel@debian.org> <1527860403.6997.72.camel@debian.org> <1528468856.6554.6.camel@debian.org> <e33be886-7975-2e2f-d2d9-a45e24408f72@case.edu>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, 2018-06-08 at 11:03 -0400, Chet Ramey wrote:
> On 6/8/18 10:40 AM, Luca Boccassi wrote:
> 
> > Any chance you had a sec to look at the diff? Would love some
> > feedback!
> 
> I'm going to try and look at it this weekend. It's been a busy couple
> of
> months.

Hi Chet,

I've seen that the change is now in the devel branch, thank you so
much!
I also like way more the new option name, definitely clearer :-)

One difference I noticed with the previous version is that when trying
to complete a command when the line starts with an empty space (eg: to
avoid the history) the initial word programmable completion doesn't
happen.

It seems to hit the following branch:

       else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0)
         {
           foundcs = 0; /* empty command name following assignments */
           in_command_position = was_assignment;
         }

Given was_assignment is 0, then the programmable completion is later
not attempted.

Since that branch matches an empty command name, should it perhaps call
the EMPTYCMD completion?
Something like:

       else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0)
         {
           foundcs = 0; /* empty command name following assignments */
           in_command_position = was_assignment;
+          if (have_progcomps)
+            prog_complete_matches = programmable_completions (EMPTYCMD, text, s, e, &foundcs);
         }

Or is there a better solution?

Thanks!

-- 
Kind regards,
Luca Boccassi

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] Add nofirstword completion option Luca Boccassi <bluca@debian.org> - 2018-06-12 18:28 +0100

csiph-web