Thread (11 messages) flat view 11 messages, 3 authors, 2016-06-15

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

From: Wincent Colaiuta <hidden>
Date: 2016-06-15 22:43:55

Possibly related (same subject, not in this thread)

El 1/12/2007, a las 3:36, Junio C Hamano escribió:
Wincent Colaiuta [off-list ref] writes:
quoted
A "hidden" feature is that any string can be entered, and an anchored
regex search is used to find the first matching option.
I'd run s/the first/the uniquely/ here.

When list_and_choose() function is letting you choose more than one
items, its prompt becomes ">> ", instead of "> " that is used for a
singleton choice.  To that prompt, you can say "3-7" (Add these 5  
items
to the choice), "*" (I want all of them), "-2-4" (exclude 2 and 3  
and 4
from the set I have chosen so far).  These are also "hidden", and need
to be documented, but that would be a separate patch.
Agreed that it belongs in a separate patch.

But I'm glad you brought this up as it reminds me of the need to watch  
out for those characters which have special meaning for  
list_and_choose().
I'd rewrite the last line to:

	return (defined $prefix) ? "[$prefix]$remainder" : $remainder;

just in case the unique prefix is "0".  Otherwise you would lose the
first letter from "00ReadMe" and show remainder "0ReadMe" alone.
Excellent catch. Crazy old perl; I didn't realize that "0" (the  
string, not the number) would evaluate to false.

Will send a separate mail with a revised, squashed patch with these  
changes:

- "s/the first/the uniquely/" in the commit message as you suggest

- filter out prefixes which contain characters with special meaning  
for list_and_choose()

- check "defined $prefix" rather than just "$prefix"

- also fixes a problem discovered while playing with this; it didn't  
play nicely with untracked files

Cheers,
Wincent
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help