allow users to configure whether the commit length is shown

This commit is contained in:
Jesse Duffield 2018-09-05 23:02:13 +10:00
parent 986774e5c7
commit a2d40cfbf1
4 changed files with 14 additions and 2 deletions

View file

@ -71,9 +71,17 @@ func (gui *Gui) simpleEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Mo
v.EditWrite(ch)
}
v.Subtitle = gui.getBufferLength(v)
gui.RenderCommitLength()
}
func (gui *Gui) getBufferLength(view *gocui.View) string {
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)
}