mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-18 02:55:11 +00:00
Fix cyclic scrolling with non-zero preview header lines
e.g. fzf --preview-window 'cycle,~2' --preview 'echo foo; echo bar; seq 100'
This commit is contained in:
parent
5798145581
commit
03d02d67f7
@ -2652,10 +2652,12 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
t.previewer.following = false
|
t.previewer.following = false
|
||||||
numLines := len(t.previewer.lines)
|
numLines := len(t.previewer.lines)
|
||||||
|
headerLines := t.previewOpts.headerLines
|
||||||
if t.previewOpts.cycle {
|
if t.previewOpts.cycle {
|
||||||
newOffset = (newOffset + numLines) % numLines
|
offsetRange := numLines - headerLines
|
||||||
|
newOffset = ((newOffset-headerLines)+offsetRange)%offsetRange + headerLines
|
||||||
}
|
}
|
||||||
newOffset = util.Constrain(newOffset, t.previewOpts.headerLines, numLines-1)
|
newOffset = util.Constrain(newOffset, headerLines, numLines-1)
|
||||||
if t.previewer.offset != newOffset {
|
if t.previewer.offset != newOffset {
|
||||||
t.previewer.offset = newOffset
|
t.previewer.offset = newOffset
|
||||||
req(reqPreviewRefresh)
|
req(reqPreviewRefresh)
|
||||||
|
Loading…
Reference in New Issue
Block a user