diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-14 09:50:52 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-19 10:47:21 +1100 |
commit | 54bd94ad24ca24ca12fab59e9dbf0d79fe7681da (patch) | |
tree | 0dd7c0819d29aa38828486f3e5c6b0a017790c5b /pkg/gui/controllers/tags_controller.go | |
parent | 8840c1a2b75749724b2dc6e329c2e150db93bc5a (diff) |
Add SetSelection function for list contexts and use it in most places
The only time we should call SetSelectedLineIdx is when we are happy for a
select range to be retained which means things like moving the selected line
index to top top/bottom or up/down a page as the user navigates.
But in every other case we should now call SetSelection because that will
set the selected index and cancel the range which is almost always what we
want.
Diffstat (limited to 'pkg/gui/controllers/tags_controller.go')
-rw-r--r-- | pkg/gui/controllers/tags_controller.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/gui/controllers/tags_controller.go b/pkg/gui/controllers/tags_controller.go index dcbef4d2c..e96dde2e4 100644 --- a/pkg/gui/controllers/tags_controller.go +++ b/pkg/gui/controllers/tags_controller.go @@ -210,7 +210,9 @@ func (self *TagsController) createResetMenu(tag *models.Tag) error { func (self *TagsController) create() error { // leaving commit SHA blank so that we're just creating the tag for the current commit - return self.c.Helpers().Tags.OpenCreateTagPrompt("", func() { self.context().SetSelectedLineIdx(0) }) + return self.c.Helpers().Tags.OpenCreateTagPrompt("", func() { + self.context().SetSelection(0) + }) } func (self *TagsController) withSelectedTag(f func(tag *models.Tag) error) func() error { |