mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-24 10:13:41 -05:00
Render content-only when a task reads more lines into a view
Reading more lines into a lazy-loaded view (e.g. a diff being scrolled) never changes the window layout, and after the first screenful it doesn't even change the visible content - the new lines land below the viewport, so the only thing that changes on screen is the scrollbar thumb. Yet each read triggered a full render: a layout pass plus a redraw of every view. On a slow terminal that full-screen repaint on every read is a big part of why scrolling through a not-yet-fully-read diff stutters. Route the task's refresh through a content-only render instead. It skips the layout pass and only redraws the views whose content changed, leaving tcell's cell-level dirty tracking to emit just the cells that actually differ (in the steady state, the scrollbar column). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
cbf220c497
commit
73d7b443ec
@@ -118,7 +118,12 @@ func (gui *Gui) getManager(view *gocui.View) *tasks.ViewBufferManager {
|
|||||||
view.Reset()
|
view.Reset()
|
||||||
},
|
},
|
||||||
func() {
|
func() {
|
||||||
gui.render()
|
// As the task reads more lines, the only thing that changes is the
|
||||||
|
// view's content (and its scrollbar); the window layout doesn't. So a
|
||||||
|
// content-only render is enough, and it's much cheaper than a full
|
||||||
|
// layout-and-redraw on every read - which matters a lot when reading
|
||||||
|
// a long diff, where reads happen repeatedly as the user scrolls.
|
||||||
|
gui.renderContentOnly()
|
||||||
},
|
},
|
||||||
func() {
|
func() {
|
||||||
// Need to check if the content of the view is well past the origin.
|
// Need to check if the content of the view is well past the origin.
|
||||||
|
|||||||
@@ -121,6 +121,14 @@ func (gui *Gui) render() {
|
|||||||
gui.c.OnUIThread(func() error { return nil })
|
gui.c.OnUIThread(func() error { return nil })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// renderContentOnly triggers a re-render that skips the layout pass and only
|
||||||
|
// redraws the views whose content changed (relying on tcell's cell-level dirty
|
||||||
|
// tracking to emit just the cells that actually differ). Use it when only a
|
||||||
|
// view's content changed, not the window layout.
|
||||||
|
func (gui *Gui) renderContentOnly() {
|
||||||
|
gui.c.OnUIThreadContentOnly(func() error { return nil })
|
||||||
|
}
|
||||||
|
|
||||||
// postRefreshUpdate is to be called on a context after the state that it depends on has been refreshed
|
// postRefreshUpdate is to be called on a context after the state that it depends on has been refreshed
|
||||||
// if the context's view is set to another context we do nothing.
|
// if the context's view is set to another context we do nothing.
|
||||||
// if the context's view is the current view we trigger a focus; re-selecting the current item.
|
// if the context's view is the current view we trigger a focus; re-selecting the current item.
|
||||||
|
|||||||
Reference in New Issue
Block a user