git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Highlight keyboard shortcuts in git-add--interactive

From
Wincent Colaiuta <win@wincent.com>
Date
Nov 29, 2007, 01:08 UTC
Message-ID
<9FA2CBB3-DD98-4349-8001-8F6B2E47F0DC@wincent.com>
In-Reply-To
<7vmysx2ac8.fsf@gitster.siamese.dyndns.org>
El 29/11/2007, a las 0:56, Junio C Hamano escribió:
Show 31 quoted lines
> Wincent Colaiuta <win@wincent.com> writes:
>
>> @@ -774,14 +774,14 @@ EOF
>> }
>>
>> sub main_loop {
>> -	my @cmd = ([ 'status', \&status_cmd, ],
>> -		   [ 'update', \&update_cmd, ],
>> -		   [ 'revert', \&revert_cmd, ],
>> -		   [ 'add untracked', \&add_untracked_cmd, ],
>> -		   [ 'patch', \&patch_update_cmd, ],
>> -		   [ 'diff', \&diff_cmd, ],
>> -		   [ 'quit', \&quit_cmd, ],
>> -		   [ 'help', \&help_cmd, ],
>> +	my @cmd = ([ 'status', \&status_cmd, '[s]tatus', ],
>> +		   [ 'update', \&update_cmd, '[u]date', ],
>> +		   [ 'revert', \&revert_cmd, '[r]evert', ],
>> +		   [ 'add untracked', \&add_untracked_cmd, '[a]dd untracked', ],
>> +		   [ 'patch', \&patch_update_cmd, '[p]atch', ],
>> +		   [ 'diff', \&diff_cmd, '[d]iff', ],
>> +		   [ 'quit', \&quit_cmd, '[q]uit', ],
>> +		   [ 'help', \&help_cmd, '[h]elp', ],
>> 	);
>
> I like the general idea of making it more obvious that you can use the
> unique prefix, but I think you should make list_and_choose do this
> automatically without adding a redundant element in the command array.
>
> If you do so, the same highlighting will automatically appear when you
> are picking which paths to update in the update subcommand, for  
> example.

Yes, I did consider that, and it's very easy when all the options have a unique, single-letter prefix, as is the case with the main command loop. But what to do if you've got a bunch of paths with lengthy common prefixes? eg. what would you highlight here?

lib/ssl/crypto/foo.c lib/ssl/crypto/bar.c lib/ssl/crypto/baz.c

Highlighting "lib/ssl/crypto/f", "lib/ssl/crypto/bar" and "lib/ssl/ crypto/baz" doesn't sound like much help... Maybe there should be some limit: if you need to go more than 3 characters deep in order to differentiate unique prefixes then perhaps highlighting should be omitted in that case. What do you think of that idea?

Cheers, Wincent

Previous: Junio C HamanoNext: Wincent Colaiuta
Message 6 of 17 in “Highlight keyboard shortcuts in git-add--interactive”
  1. Highlight keyboard shortcuts in git-add--interactiveWincent Colaiuta, Nov 21, 2007
  2. Matthieu MoyNov 21, 2007
  3. Jeff KingNov 21, 2007
  4. Dan ZwellNov 21, 2007
  5. Junio C HamanoNov 28, 2007
  6. Wincent ColaiutaNov 29, 2007
  7. Highlight keyboard shortcuts in git-add--interactiveWincent Colaiuta, Nov 29, 2007
  8. Jeff KingNov 29, 2007
  9. Junio C HamanoDec 1, 2007
  10. Wincent ColaiutaDec 1, 2007
  11. 1/2 Highlight keyboard shortcuts in git-add--interactiveWincent Colaiuta, Dec 1, 2007
  12. 2/2 Teach git-add--interactive to highlight untracked file prefixesWincent Colaiuta, Dec 1, 2007
  13. Wincent ColaiutaDec 1, 2007
  14. Highlight keyboard shortcuts in git-add--interactiveWincent Colaiuta, Dec 1, 2007
  15. Wincent ColaiutaDec 2, 2007
  16. Junio C HamanoDec 2, 2007
  17. Wincent ColaiutaDec 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.