mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
Merge branch 'master' into hotfix/273-cursor-scrolling
This commit is contained in:
commit
53aef7846a
@ -37,6 +37,10 @@ func (gui *Gui) handleCommitClose(g *gocui.Gui, v *gocui.View) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleCommitFocused(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) handleCommitFocused(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
if _, err := g.SetViewOnTop("commitMessage"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
message := gui.Tr.TemplateLocalize(
|
message := gui.Tr.TemplateLocalize(
|
||||||
"CloseConfirm",
|
"CloseConfirm",
|
||||||
Teml{
|
Teml{
|
||||||
|
@ -133,8 +133,15 @@ func (gui *Gui) switchFocus(g *gocui.Gui, oldView, newView *gocui.View) error {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
gui.Log.Info(message)
|
gui.Log.Info(message)
|
||||||
|
|
||||||
|
// second class panels should never have focus restored to them because
|
||||||
|
// once they lose focus they are effectively 'destroyed'
|
||||||
|
secondClassPanels := []string{"confirmation", "menu"}
|
||||||
|
if !utils.IncludesString(secondClassPanels, oldView.Name()) {
|
||||||
gui.State.PreviousView = oldView.Name()
|
gui.State.PreviousView = oldView.Name()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
newView.Highlight = true
|
newView.Highlight = true
|
||||||
message := gui.Tr.TemplateLocalize(
|
message := gui.Tr.TemplateLocalize(
|
||||||
"newFocusedViewIs",
|
"newFocusedViewIs",
|
||||||
|
@ -204,3 +204,13 @@ func getDisplayStringArrays(displayables []Displayable) [][]string {
|
|||||||
}
|
}
|
||||||
return stringArrays
|
return stringArrays
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IncludesString if the list contains the string
|
||||||
|
func IncludesString(list []string, a string) bool {
|
||||||
|
for _, b := range list {
|
||||||
|
if b == a {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@ -376,3 +376,38 @@ func TestMin(t *testing.T) {
|
|||||||
assert.EqualValues(t, s.expected, Min(s.a, s.b))
|
assert.EqualValues(t, s.expected, Min(s.a, s.b))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIncludesString(t *testing.T) {
|
||||||
|
type scenario struct {
|
||||||
|
list []string
|
||||||
|
element string
|
||||||
|
expected bool
|
||||||
|
}
|
||||||
|
|
||||||
|
scenarios := []scenario{
|
||||||
|
{
|
||||||
|
[]string{"a", "b"},
|
||||||
|
"a",
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
[]string{"a", "b"},
|
||||||
|
"c",
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
[]string{"a", "b"},
|
||||||
|
"",
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
[]string{""},
|
||||||
|
"",
|
||||||
|
true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, s := range scenarios {
|
||||||
|
assert.EqualValues(t, s.expected, IncludesString(s.list, s.element))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user