On 6/12/18 1:28 PM, Luca Boccassi wrote:
> 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?

It's not an empty command line, since it starts with point after column 0.
It should perform command completion, though.

Try the attached patch, or wait for the next devel branch push.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/
*** /fs2/chet/bash/bash-20180608/bashline.c     2018-06-08 14:58:14.000000000 
-0400
--- bashline.c  2018-06-12 14:43:38.000000000 -0400
***************
*** 1593,1598 ****
        else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0)
          {
!           foundcs = 0;        /* empty command name following assignments */
!           in_command_position = was_assignment;
          }
        else if (s == start && e == end && STREQ (n, text) && start > 0)
--- 1593,1598 ----
        else if (s >= e && n[0] == '\0' && text[0] == '\0' && start > 0)
          {
!           foundcs = 0;        /* empty command name following optional 
assignments */
!           in_command_position += was_assignment;
          }
        else if (s == start && e == end && STREQ (n, text) && start > 0)
***************
*** 1606,1610 ****
        /* If we have defined a compspec for the initial (command) word, call
         it and process the results like any other programmable completion. */
!       if (in_command_position && foundcs == 0 && iw_compspec)
        prog_complete_matches = programmable_completions (INITIALWORD, text, s, 
e, &foundcs);
  
--- 1606,1610 ----
        /* If we have defined a compspec for the initial (command) word, call
         it and process the results like any other programmable completion. */
!       if (in_command_position && have_progcomps && foundcs == 0 && 
iw_compspec)
        prog_complete_matches = programmable_completions (INITIALWORD, text, s, 
e, &foundcs);
  

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to