Skip to content

Commit

Permalink
Fix invalid memory access when the preview window becomes hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Mar 8, 2024
1 parent 0cc27c3 commit eec557b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3161,7 +3161,7 @@ func (t *Terminal) Loop() {
}
t.previewer.lines = result.lines
t.previewer.spinner = result.spinner
if t.previewer.following.Enabled() {
if t.hasPreviewWindow() && t.previewer.following.Enabled() {
t.previewer.offset = util.Max(t.previewer.offset, len(t.previewer.lines)-(t.pwindow.Height()-t.previewOpts.headerLines))
} else if result.offset >= 0 {
t.previewer.offset = util.Constrain(result.offset, t.previewOpts.headerLines, len(t.previewer.lines)-1)
Expand Down

0 comments on commit eec557b

Please sign in to comment.