diff --git a/docs/Config.md b/docs/Config.md index e791c2579..c64e56d2e 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -87,6 +87,11 @@ gui: # - 'top': split the window vertically (side panel on top, main view below) enlargedSideViewLocation: left + # If true, wrap lines in the staging view to the width of the view. This + # makes it much easier to work with diffs that have long lines, e.g. + # paragraphs of markdown text. + wrapLinesInStagingView: true + # One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru' language: auto diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 1148bb947..36dc02a68 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -91,6 +91,10 @@ type GuiConfig struct { // - 'left': split the window horizontally (side panel on the left, main view on the right) // - 'top': split the window vertically (side panel on top, main view below) EnlargedSideViewLocation string `yaml:"enlargedSideViewLocation"` + // If true, wrap lines in the staging view to the width of the view. This + // makes it much easier to work with diffs that have long lines, e.g. + // paragraphs of markdown text. + WrapLinesInStagingView bool `yaml:"wrapLinesInStagingView"` // One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru' Language string `yaml:"language" jsonschema:"enum=auto,enum=en,enum=zh-TW,enum=zh-CN,enum=pl,enum=nl,enum=ja,enum=ko,enum=ru"` // Format used when displaying time e.g. commit time. @@ -692,6 +696,7 @@ func GetDefaultConfig() *UserConfig { ExpandedSidePanelWeight: 2, MainPanelSplitMode: "flexible", EnlargedSideViewLocation: "left", + WrapLinesInStagingView: true, Language: "auto", TimeFormat: "02 Jan 06", ShortTimeFormat: time.Kitchen, diff --git a/pkg/gui/controllers/patch_building_controller.go b/pkg/gui/controllers/patch_building_controller.go index a76d3f5bd..7bc0ffb83 100644 --- a/pkg/gui/controllers/patch_building_controller.go +++ b/pkg/gui/controllers/patch_building_controller.go @@ -65,7 +65,7 @@ func (self *PatchBuildingController) GetMouseKeybindings(opts types.KeybindingsO func (self *PatchBuildingController) GetOnFocus() func(types.OnFocusOpts) { return func(opts types.OnFocusOpts) { // no need to change wrap on the secondary view because it can't be interacted with - self.c.Views().PatchBuilding.Wrap = false + self.c.Views().PatchBuilding.Wrap = self.c.UserConfig().Gui.WrapLinesInStagingView self.c.Helpers().PatchBuilding.RefreshPatchBuildingPanel(opts) } diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go index b2da2cd3f..fbcbc049b 100644 --- a/pkg/gui/controllers/staging_controller.go +++ b/pkg/gui/controllers/staging_controller.go @@ -118,8 +118,9 @@ func (self *StagingController) GetMouseKeybindings(opts types.KeybindingsOpts) [ func (self *StagingController) GetOnFocus() func(types.OnFocusOpts) { return func(opts types.OnFocusOpts) { - self.c.Views().Staging.Wrap = false - self.c.Views().StagingSecondary.Wrap = false + wrap := self.c.UserConfig().Gui.WrapLinesInStagingView + self.c.Views().Staging.Wrap = wrap + self.c.Views().StagingSecondary.Wrap = wrap self.c.Helpers().Staging.RefreshStagingPanel(opts) } diff --git a/schema/config.json b/schema/config.json index ee5726740..ee6f37ca5 100644 --- a/schema/config.json +++ b/schema/config.json @@ -96,6 +96,11 @@ "description": "How the window is split when in half screen mode (i.e. after hitting '+' once).\nPossible values:\n- 'left': split the window horizontally (side panel on the left, main view on the right)\n- 'top': split the window vertically (side panel on top, main view below)", "default": "left" }, + "wrapLinesInStagingView": { + "type": "boolean", + "description": "If true, wrap lines in the staging view to the width of the view. This\nmakes it much easier to work with diffs that have long lines, e.g.\nparagraphs of markdown text.", + "default": true + }, "language": { "type": "string", "enum": [