Hi Dscho
On 16/08/2022 11:00, Johannes Schindelin wrote:
Hi Phillip,
On Thu, 11 Aug 2022, Phillip Wood wrote:
On 10/08/2022 16:02, Johannes Schindelin via GitGitGadget wrote:
diff --git a/add-patch.c b/add-patch.c
index 509ca04456b..3524555e2b0 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1547,7 +1547,7 @@ soft_increment:
strbuf_remove(&s->answer, 0, 1);
strbuf_trim(&s->answer);
Unrelated to this change but why don't we just call strbuf_reset() here?
This part of the code is used when the `g` command (to "go to hunk") was
issued by the user. And that `g` command allows for a number to be
specified, e.g. `g1` to go to the first hunk.
The `strbuf_remove(&s->answer, 0, 1)` removes the `g` from the command.
The `strbuf_trim(&s->answer)` allows for whitespace between the `g` and
the number, e.g. `g 1` should also go to the first hunk.
If we called `strbuf_reset()` here, we would remove the number completely.
Oh so if the user is not using interactive.singleKey then they can skip
the prompt which displays the hunks and asks which one they want to jump
to by guessing the number of the hunk they want and typing "g <n>".
Thanks
Phillip
Ciao,
Dscho