mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-11-28 09:08:41 +02:00
Disable range-select in menu and suggestions view
We don't need it there so no need to enable it. I'm leaving the disabled reason checks there, even though they're now redundant, because they're only one-liners and they communicate intent.
This commit is contained in:
parent
51fb82d6bf
commit
1ea0c270df
@ -118,3 +118,8 @@ func (self *ListContextTrait) IsItemVisible(item types.HasUrn) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// By default, list contexts supporta range select
|
||||
func (self *ListContextTrait) RangeSelectEnabled() bool {
|
||||
return true
|
||||
}
|
||||
|
@ -195,3 +195,8 @@ func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// There is currently no need to use range-select in a menu so we're disabling it.
|
||||
func (self *MenuContext) RangeSelectEnabled() bool {
|
||||
return false
|
||||
}
|
||||
|
@ -90,3 +90,8 @@ func (self *SuggestionsContext) RefreshSuggestions() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// There is currently no need to use range-select in the suggestions view so we're disabling it.
|
||||
func (self *SuggestionsContext) RangeSelectEnabled() bool {
|
||||
return false
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ func (self *ListController) isFocused() bool {
|
||||
}
|
||||
|
||||
func (self *ListController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
||||
return []*types.Binding{
|
||||
bindings := []*types.Binding{
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevItemAlt), Handler: self.HandlePrevLine},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevItem), Handler: self.HandlePrevLine},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextItemAlt), Handler: self.HandleNextLine},
|
||||
@ -194,10 +194,19 @@ func (self *ListController) GetKeybindings(opts types.KeybindingsOpts) []*types.
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ScrollLeft), Handler: self.HandleScrollLeft},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ScrollRight), Handler: self.HandleScrollRight},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoBottom), Handler: self.HandleGotoBottom, Description: self.c.Tr.GotoBottom},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ToggleRangeSelect), Handler: self.HandleToggleRangeSelect, Description: self.c.Tr.ToggleRangeSelect},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.RangeSelectDown), Handler: self.HandleRangeSelectDown, Description: self.c.Tr.RangeSelectDown},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.RangeSelectUp), Handler: self.HandleRangeSelectUp, Description: self.c.Tr.RangeSelectUp},
|
||||
}
|
||||
|
||||
if self.context.RangeSelectEnabled() {
|
||||
bindings = append(bindings,
|
||||
[]*types.Binding{
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ToggleRangeSelect), Handler: self.HandleToggleRangeSelect, Description: self.c.Tr.ToggleRangeSelect},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.RangeSelectDown), Handler: self.HandleRangeSelectDown, Description: self.c.Tr.RangeSelectDown},
|
||||
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.RangeSelectUp), Handler: self.HandleRangeSelectUp, Description: self.c.Tr.RangeSelectUp},
|
||||
}...,
|
||||
)
|
||||
}
|
||||
|
||||
return bindings
|
||||
}
|
||||
|
||||
func (self *ListController) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding {
|
||||
|
@ -144,6 +144,7 @@ type IListContext interface {
|
||||
|
||||
FocusLine()
|
||||
IsListContext() // used for type switch
|
||||
RangeSelectEnabled() bool
|
||||
}
|
||||
|
||||
type IPatchExplorerContext interface {
|
||||
|
Loading…
Reference in New Issue
Block a user