summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-09-05 23:02:13 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-09-05 23:02:13 +1000
commita2d40cfbf1df9c6cd7107e9356cca6dbac031f40 (patch)
treecda6bc640b3a7845a20c65c70e53dcda1c93694a
parent986774e5c7ddf5c1de1e1adb831baac84a2dae66 (diff)
allow users to configure whether the commit length is shown
-rw-r--r--docs/Config.md2
-rw-r--r--pkg/config/app_config.go2
-rw-r--r--pkg/gui/commit_message_panel.go10
-rw-r--r--pkg/gui/files_panel.go2
4 files changed, 14 insertions, 2 deletions
diff --git a/docs/Config.md b/docs/Config.md
index eb1c65f9a..76cf4bcc0 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -14,6 +14,8 @@
- white
optionsTextColor:
- blue
+ commitLength:
+ show: true
update:
method: prompt # can be: prompt | background | never
days: 14 # how often an update is checked for
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index 3c272e520..ae713a212 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -222,6 +222,8 @@ func GetDefaultConfig() []byte {
- white
optionsTextColor:
- blue
+ commitLength:
+ show: true
update:
method: prompt # can be: prompt | background | never
days: 14 # how often a update is checked for
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 7ac566b3f..99d649102 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -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)
+}
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index f85ff9d33..1971b3453 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -226,7 +226,7 @@ func (gui *Gui) handleCommitPress(g *gocui.Gui, filesView *gocui.View) error {
g.Update(func(g *gocui.Gui) error {
g.SetViewOnTop("commitMessage")
gui.switchFocus(g, filesView, commitMessageView)
- commitMessageView.Subtitle = gui.getBufferLength(commitMessageView)
+ gui.RenderCommitLength()
return nil
})
return nil