summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-11-19 16:39:01 +0100
committerStefan Haller <stefan@haller-berlin.de>2024-03-09 10:00:44 +0100
commitcede0214009888e32027beb212b63e30e77d29e7 (patch)
tree3250b10371af9b195a36aaf1cd303feb7d3644ad
parent99ad6005e82e49e84121121feb4255e09dbb8673 (diff)
Add config for soft-wrapping the commit message body
-rw-r--r--docs/Config.md2
-rw-r--r--pkg/config/user_config.go8
-rw-r--r--pkg/gui/views.go2
-rw-r--r--schema/config.json10
4 files changed, 21 insertions, 1 deletions
diff --git a/docs/Config.md b/docs/Config.md
index 5b686fc19..4b26c5f84 100644
--- a/docs/Config.md
+++ b/docs/Config.md
@@ -92,6 +92,8 @@ git:
useConfig: false
commit:
signOff: false
+ autoWrapCommitMessage: true # automatic WYSIWYG wrapping of the commit message as you type
+ autoWrapWidth: 72 # if autoWrapCommitMessage is true, the width to wrap to
merging:
# only applicable to unix users
manualCommit: false
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go
index 9cb758259..6a4efe78a 100644
--- a/pkg/config/user_config.go
+++ b/pkg/config/user_config.go
@@ -236,6 +236,10 @@ type PagingConfig struct {
type CommitConfig struct {
// If true, pass '--signoff' flag when committing
SignOff bool `yaml:"signOff"`
+ // Automatic WYSIWYG wrapping of the commit message as you type
+ AutoWrapCommitMessage bool `yaml:"autoWrapCommitMessage"`
+ // If autoWrapCommitMessage is true, the width to wrap to
+ AutoWrapWidth int `yaml:"autoWrapWidth"`
}
type MergingConfig struct {
@@ -658,7 +662,9 @@ func GetDefaultConfig() *UserConfig {
ExternalDiffCommand: "",
},
Commit: CommitConfig{
- SignOff: false,
+ SignOff: false,
+ AutoWrapCommitMessage: true,
+ AutoWrapWidth: 72,
},
Merging: MergingConfig{
ManualCommit: false,
diff --git a/pkg/gui/views.go b/pkg/gui/views.go
index 13caa9c7f..9fd775764 100644
--- a/pkg/gui/views.go
+++ b/pkg/gui/views.go
@@ -168,6 +168,8 @@ func (gui *Gui) createAllViews() error {
gui.Views.CommitDescription.FgColor = theme.GocuiDefaultTextColor
gui.Views.CommitDescription.Editable = true
gui.Views.CommitDescription.Editor = gocui.EditorFunc(gui.commitDescriptionEditor)
+ gui.Views.CommitDescription.TextArea.AutoWrap = gui.c.UserConfig.Git.Commit.AutoWrapCommitMessage
+ gui.Views.CommitDescription.TextArea.AutoWrapWidth = gui.c.UserConfig.Git.Commit.AutoWrapWidth
gui.Views.Confirmation.Visible = false
gui.Views.Confirmation.Editor = gocui.EditorFunc(gui.promptEditor)
diff --git a/schema/config.json b/schema/config.json
index b95381302..44d8e0cb4 100644
--- a/schema/config.json
+++ b/schema/config.json
@@ -405,6 +405,16 @@
"signOff": {
"type": "boolean",
"description": "If true, pass '--signoff' flag when committing"
+ },
+ "autoWrapCommitMessage": {
+ "type": "boolean",
+ "description": "Automatic WYSIWYG wrapping of the commit message as you type",
+ "default": true
+ },
+ "autoWrapWidth": {
+ "type": "integer",
+ "description": "If autoWrapCommitMessage is true, the width to wrap to",
+ "default": 72
}
},
"additionalProperties": false,