summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/controllers')
-rw-r--r--pkg/gui/controllers/helpers/window_arrangement_helper.go7
-rw-r--r--pkg/gui/controllers/screen_mode_actions.go27
2 files changed, 29 insertions, 5 deletions
diff --git a/pkg/gui/controllers/helpers/window_arrangement_helper.go b/pkg/gui/controllers/helpers/window_arrangement_helper.go
index 0eb7cdb4a..322cd1bd6 100644
--- a/pkg/gui/controllers/helpers/window_arrangement_helper.go
+++ b/pkg/gui/controllers/helpers/window_arrangement_helper.go
@@ -8,7 +8,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
- "github.com/mattn/go-runewidth"
"golang.org/x/exp/slices"
)
@@ -272,7 +271,7 @@ func infoSectionChildren(args WindowArrangementArgs) []*boxlayout.Box {
return []*boxlayout.Box{
{
Window: "searchPrefix",
- Size: runewidth.StringWidth(args.SearchPrefix),
+ Size: utils.StringWidth(args.SearchPrefix),
},
{
Window: "search",
@@ -325,7 +324,7 @@ func infoSectionChildren(args WindowArrangementArgs) []*boxlayout.Box {
// app status appears very briefly in demos and dislodges the caption,
// so better not to show it at all
if args.AppStatus != "" {
- result = append(result, &boxlayout.Box{Window: "appStatus", Size: runewidth.StringWidth(args.AppStatus)})
+ result = append(result, &boxlayout.Box{Window: "appStatus", Size: utils.StringWidth(args.AppStatus)})
}
}
@@ -338,7 +337,7 @@ func infoSectionChildren(args WindowArrangementArgs) []*boxlayout.Box {
&boxlayout.Box{
Window: "information",
// unlike appStatus, informationStr has various colors so we need to decolorise before taking the length
- Size: runewidth.StringWidth(utils.Decolorise(args.InformationStr)),
+ Size: utils.StringWidth(utils.Decolorise(args.InformationStr)),
})
}
diff --git a/pkg/gui/controllers/screen_mode_actions.go b/pkg/gui/controllers/screen_mode_actions.go
index 1db27f2e2..2d0026793 100644
--- a/pkg/gui/controllers/screen_mode_actions.go
+++ b/pkg/gui/controllers/screen_mode_actions.go
@@ -1,6 +1,7 @@
package controllers
import (
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@@ -16,7 +17,7 @@ func (self *ScreenModeActions) Next() error {
),
)
- return nil
+ return self.rerenderViewsWithScreenModeDependentContent()
}
func (self *ScreenModeActions) Prev() error {
@@ -27,9 +28,33 @@ func (self *ScreenModeActions) Prev() error {
),
)
+ return self.rerenderViewsWithScreenModeDependentContent()
+}
+
+// these views need to be re-rendered when the screen mode changes. The commits view,
+// for example, will show authorship information in half and full screen mode.
+func (self *ScreenModeActions) rerenderViewsWithScreenModeDependentContent() error {
+ for _, context := range self.c.Context().AllList() {
+ if context.NeedsRerenderOnWidthChange() == types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_SCREEN_MODE_CHANGES {
+ if err := self.rerenderView(context.GetView()); err != nil {
+ return err
+ }
+ }
+ }
+
return nil
}
+func (self *ScreenModeActions) rerenderView(view *gocui.View) error {
+ context, ok := self.c.Helpers().View.ContextForView(view.Name())
+ if !ok {
+ self.c.Log.Errorf("no context found for view %s", view.Name())
+ return nil
+ }
+
+ return context.HandleRender()
+}
+
func nextIntInCycle(sl []types.WindowMaximisation, current types.WindowMaximisation) types.WindowMaximisation {
for i, val := range sl {
if val == current {