diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-09-06 13:21:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-06 13:21:49 +0200 |
commit | 2d0c7cb0fc85e3c262837eb9691813fa97e00e80 (patch) | |
tree | 1090a8095b3e53b72912e53549acbe8265aa4fa7 | |
parent | 4c6c915a776cd682e5424a05ef290baa6f596f52 (diff) | |
parent | f5b8619ded50b9f3507104a8a914eabbadd25316 (diff) |
Switch to Files panel after popping a stash (#3888)v0.44.0
#### PR Description
I find myself always switching to the Files panel after popping a stash,
100% of the time, so it makes sense that lazygit does this for me. Do it
for apply as well, for consistency.
#### Please check if the PR fulfills these requirements
* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [x] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [ ] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [ ] If a new UserConfig entry was added, make sure it can be
hot-reloaded (see
[here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig))
* [ ] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc
-rw-r--r-- | pkg/gui/controllers/stash_controller.go | 2 | ||||
-rw-r--r-- | pkg/integration/tests/stash/apply.go | 1 | ||||
-rw-r--r-- | pkg/integration/tests/stash/pop.go | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/pkg/gui/controllers/stash_controller.go b/pkg/gui/controllers/stash_controller.go index 4d1cd7233..808376c53 100644 --- a/pkg/gui/controllers/stash_controller.go +++ b/pkg/gui/controllers/stash_controller.go @@ -111,6 +111,7 @@ func (self *StashController) handleStashApply(stashEntry *models.StashEntry) err if err != nil { return err } + self.c.Context().Push(self.c.Contexts().Files) return nil } @@ -137,6 +138,7 @@ func (self *StashController) handleStashPop(stashEntry *models.StashEntry) error if err != nil { return err } + self.c.Context().Push(self.c.Contexts().Files) return nil } diff --git a/pkg/integration/tests/stash/apply.go b/pkg/integration/tests/stash/apply.go index 379f2fa2f..768ab084d 100644 --- a/pkg/integration/tests/stash/apply.go +++ b/pkg/integration/tests/stash/apply.go @@ -36,6 +36,7 @@ var Apply = NewIntegrationTest(NewIntegrationTestArgs{ ) t.Views().Files(). + IsFocused(). Lines( Contains("file"), ) diff --git a/pkg/integration/tests/stash/pop.go b/pkg/integration/tests/stash/pop.go index 9eec96c55..c7e640072 100644 --- a/pkg/integration/tests/stash/pop.go +++ b/pkg/integration/tests/stash/pop.go @@ -34,6 +34,7 @@ var Pop = NewIntegrationTest(NewIntegrationTestArgs{ IsEmpty() t.Views().Files(). + IsFocused(). Lines( Contains("file"), ) |