On Tue, May 21, 2024 at 7:20 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > In an "git add -p" session, especially when we are not using the > single-char mode, we may see 'qa' as a response to a prompt > > (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]? > > and then just do the 'q' thing (i.e. quit the session), ignoring > everything other than the first byte. > > If 'q' and 'a' are next to each other on the user's keyboard, there > is a plausible chance that we see 'qa' when the user who wanted to > say 'a' fat-fingered and we ended up doing the 'q' thing instead. > > As we didn't think of a good reason during the review discussion why > we want to accept excess letters only to ignore them, it appears to > be a safe change to simply reject input that is longer than just one > byte. > > The two exceptions are the 'g' command that takes a hunk number, and > the '/' command that takes a regular expression. They has to be s/has/have/ > accompanied by their operands (this makes me wonder how users who > set the interactive.singlekey configuration feed these operands---it > turns out that we notice there is no operand and give them another > chance to type the operand separately, without using single key > input this time), so we accept a string that is more than one byte > long. > > Keep the "use only the first byte, downcased" behaviour when we ask > yes/no question, though. Neither on Qwerty or on Dvorak, 'y' and > 'n' are not close to each other. > > Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>