lazygit
lazygit copied to clipboard
Focus commits view after moving custom patch into new commit
Is your feature request related to a problem? Please describe. When a custom patch is moved out into a new commit, we stay in the commit files view but end up looking at the new commit's files. This is a bit jarring: the important context we want to show the user is where this new commit is situated compared to the existing ones. The user already knows what changes the new commit contains because they just selected the changes themselves, and if they want to double-check they can easily press enter to view them.
Describe the solution you'd like Focus the commits view after moving a custom patch out into a new commit.
Hey @jesseduffield - I started working on this, but I need clarification on the best path.
I was trying to intercept the error coming from CheckMergeOrRebase
to avoid focusing the local commit's context in case of an error here: https://github.com/jesseduffield/lazygit/blob/49df908dd310a9cf793a58d974256e9368f4cdd6/pkg/gui/controllers/custom_patch_options_menu_action.go#L219
The problem is that the isMergeConflictErr
method does not propagate the original error and returns the one coming from the ErrorMsg
method: https://github.com/jesseduffield/lazygit/blob/49df908dd310a9cf793a58d974256e9368f4cdd6/pkg/gui/controllers/helpers/merge_and_rebase_helper.go#L173
What do you think is the best solution here? Thanks!
P.S. Feel free to assign this issue to me :)
@AzraelSec sorry for the late reply: Let me know if this isn't what you asked, but if we get a merge conflict, then I would still want the commit view to be focused because that's what the user would want to see.
@jesseduffield thanks for responding. I just restarted from a blank branch a couple of days ago and am trying to remember exactly what my comment's context was. I created a PR for this; let's see if my code looks what you'd expect it to be 👍🏻