# HG changeset patch # User Jordi Gutiérrez Hermoso <jord...@octave.org> # Date 1576015329 18000 # Tue Dec 10 17:02:09 2019 -0500 # Node ID bd10bc4bdb994b875040c0c58f1c341df66ddd46 # Parent ce088b38f92b6d480df2072dc45fb068443758dd crecord: repurpose "a" key to toggle all selections (BC)
I really don't like "a". I keep accidentally hitting it when I actually want "A", and then I'm suddenly in a state I don't want to be in. There's a big wall of text telling me that I've turned amend mode on or off (which one was I orginally in?), and this seems very useless. If I wanted to amend or not, I would have chosen that from the command-line, not change my mind after I've already started picking hunks apart. It seems much better to repurpose this key to be a "weaker" version of "A". It toggles all selections. This is pretty harmless if hit accidentally, (can just hit "a" again to undo it), and has immediate visual feedback that something happened: all the x's and blank spaces get switched around. And unlike with amend, the current flipped state is also immediately visible without having to read a wall of text. I'm calling this a BC, however, because somewhere, someone out there has probably really fallen in love with the old use of "a" and will get angry that we took it away. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -990,6 +990,13 @@ class curseschunkselector(object): self.toggleapply(item) self.waslasttoggleallapplied = not self.waslasttoggleallapplied + def flipselections(self): + b"flip all selections" + for header in self.headerlist: + for hunk in header.allchildren(): + for line in hunk.allchildren(): + self.toggleapply(line) + def toggleallbetween(self): """toggle applied on or off for all items in range [lastapplied, current]. """ @@ -1637,7 +1644,7 @@ the following are valid keystrokes: ctrl-l : scroll the selected line to the top of the screen m : edit / resume editing the commit message e : edit the currently selected hunk - a : toggle amend mode, only with commit -i + a : toggle all selections c : confirm selected changes r : review/edit and confirm selected changes q : quit without confirming (no changes will be made) @@ -1913,7 +1920,7 @@ are you sure you want to review/edit and elif keypressed in ["q"]: raise error.Abort(_(b'user quit')) elif keypressed in ['a']: - self.toggleamend(self.opts, test) + self.flipselections() elif keypressed in ["c"]: return True elif keypressed in ["r"]: _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel