summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/sub_commits_context.go
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-06-22 18:00:31 +0200
committerStefan Haller <stefan@haller-berlin.de>2024-06-23 13:10:48 +0200
commita67eda39a56440f54be7fbb43974fa7a966bce53 (patch)
treeb1b7d0c488a7502fd4874a5a3dd9de92c6a26a4b /pkg/gui/context/sub_commits_context.go
parent8e1464f720d839b6e2c493b8fead0e4d39bbaaa7 (diff)
Rerender fewer views when their width changes
In d5b4f7bb3e and 58a83b0862 we introduced a combined mechanism for rerendering views when either their width changes (needed for the branches view which truncates long branch names), or the screen mode (needed for those views that display more information in half or full screen mode, e.g. the commits view). This was a bad idea, because it unnecessarily rerenders too many views when just their width changes, which causes a noticable lag. This is a problem, for example, when selecting a file in the files panel that has only unstaged changes, and then going to one that has both staged and unstaged changes; this splits the main view, causing the side panels to become a bit narrower, and rerendering all those views took almost 500ms on my machine. Another similar example is entering or leaving staging mode. Fix this by being more specific about which views need rerendering under what conditions; this improves the time it takes to rerender in the above scenarios from 450-500s down to about 20ms. This reintroduces the code that was removed in 58a83b0862, but in a slightly different way.
Diffstat (limited to 'pkg/gui/context/sub_commits_context.go')
-rw-r--r--pkg/gui/context/sub_commits_context.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go
index ab0d2784a..ddbb380c5 100644
--- a/pkg/gui/context/sub_commits_context.go
+++ b/pkg/gui/context/sub_commits_context.go
@@ -121,7 +121,7 @@ func NewSubCommitsContext(
Kind: types.SIDE_CONTEXT,
Focusable: true,
Transient: true,
- NeedsRerenderOnWidthChange: true,
+ NeedsRerenderOnWidthChange: types.NEEDS_RERENDER_ON_WIDTH_CHANGE_WHEN_SCREEN_MODE_CHANGES,
NeedsRerenderOnHeightChange: true,
})),
ListRenderer: ListRenderer{