1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 22:33:07 +02:00

Allow rewording and dropping commits in filtering mode

There's no reason not to allow these.

Technically we could enable a few more, but I chose not to because some might be
surprising or confusing in filtering mode. For example, creating a fixup commit
would work (shift-F), but the newly created commit might not show up if it
doesn't match the filter. Similarly, pressing `f` to fixup a commit into its
parent would work, but that parent commit might not be visible, so users might
expect to be fixing up into the next visible commit.
This commit is contained in:
Stefan Haller
2025-07-19 14:18:08 +02:00
parent bc936e8d1b
commit 52be6964ed
4 changed files with 94 additions and 3 deletions

View File

@ -84,7 +84,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
},
{
Key: opts.GetKey(opts.Config.Commits.RenameCommit),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.reword)),
Handler: self.withItem(self.reword),
GetDisabledReason: self.require(
self.singleItemSelected(self.rewordEnabled),
),
@ -95,7 +95,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
},
{
Key: opts.GetKey(opts.Config.Commits.RenameCommitWithEditor),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.rewordEditor)),
Handler: self.withItem(self.rewordEditor),
GetDisabledReason: self.require(
self.singleItemSelected(self.rewordEnabled),
),
@ -103,7 +103,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: opts.Guards.OutsideFilterMode(self.withItemsRange(self.drop)),
Handler: self.withItemsRange(self.drop),
GetDisabledReason: self.require(
self.itemRangeSelected(
self.canDropCommits,