mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
allow users to configure whether the commit length is shown
This commit is contained in:
parent
986774e5c7
commit
a2d40cfbf1
4 changed files with 14 additions and 2 deletions
|
@ -14,6 +14,8 @@
|
||||||
- white
|
- white
|
||||||
optionsTextColor:
|
optionsTextColor:
|
||||||
- blue
|
- blue
|
||||||
|
commitLength:
|
||||||
|
show: true
|
||||||
update:
|
update:
|
||||||
method: prompt # can be: prompt | background | never
|
method: prompt # can be: prompt | background | never
|
||||||
days: 14 # how often an update is checked for
|
days: 14 # how often an update is checked for
|
||||||
|
|
|
@ -222,6 +222,8 @@ func GetDefaultConfig() []byte {
|
||||||
- white
|
- white
|
||||||
optionsTextColor:
|
optionsTextColor:
|
||||||
- blue
|
- blue
|
||||||
|
commitLength:
|
||||||
|
show: true
|
||||||
update:
|
update:
|
||||||
method: prompt # can be: prompt | background | never
|
method: prompt # can be: prompt | background | never
|
||||||
days: 14 # how often a update is checked for
|
days: 14 # how often a update is checked for
|
||||||
|
|
|
@ -71,9 +71,17 @@ func (gui *Gui) simpleEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Mo
|
||||||
v.EditWrite(ch)
|
v.EditWrite(ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
v.Subtitle = gui.getBufferLength(v)
|
gui.RenderCommitLength()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) getBufferLength(view *gocui.View) string {
|
func (gui *Gui) getBufferLength(view *gocui.View) string {
|
||||||
return " " + strconv.Itoa(strings.Count(view.Buffer(), "")-1) + " "
|
return " " + strconv.Itoa(strings.Count(view.Buffer(), "")-1) + " "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) RenderCommitLength() {
|
||||||
|
if !gui.Config.GetUserConfig().GetBool("gui.commitLength.show") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
v := gui.getCommitMessageView(gui.g)
|
||||||
|
v.Subtitle = gui.getBufferLength(v)
|
||||||
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ func (gui *Gui) handleCommitPress(g *gocui.Gui, filesView *gocui.View) error {
|
||||||
g.Update(func(g *gocui.Gui) error {
|
g.Update(func(g *gocui.Gui) error {
|
||||||
g.SetViewOnTop("commitMessage")
|
g.SetViewOnTop("commitMessage")
|
||||||
gui.switchFocus(g, filesView, commitMessageView)
|
gui.switchFocus(g, filesView, commitMessageView)
|
||||||
commitMessageView.Subtitle = gui.getBufferLength(commitMessageView)
|
gui.RenderCommitLength()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue