mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-31 14:01:47 +00:00
Redraw preview scrollbar when window width changes
This commit is contained in:
parent
3148b0f3e8
commit
d004eb1f7c
@ -145,6 +145,7 @@ type previewer struct {
|
|||||||
following resumableState
|
following resumableState
|
||||||
spinner string
|
spinner string
|
||||||
bar []bool
|
bar []bool
|
||||||
|
xw [2]int
|
||||||
}
|
}
|
||||||
|
|
||||||
type previewed struct {
|
type previewed struct {
|
||||||
@ -857,7 +858,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor
|
|||||||
initialPreviewOpts: opts.Preview,
|
initialPreviewOpts: opts.Preview,
|
||||||
previewOpts: opts.Preview,
|
previewOpts: opts.Preview,
|
||||||
activePreviewOpts: &opts.Preview,
|
activePreviewOpts: &opts.Preview,
|
||||||
previewer: previewer{0, []string{}, 0, false, true, disabledState, "", []bool{}},
|
previewer: previewer{0, []string{}, 0, false, true, disabledState, "", []bool{}, [2]int{0, 0}},
|
||||||
previewed: previewed{0, 0, 0, false, false, false, false},
|
previewed: previewed{0, 0, 0, false, false, false, false},
|
||||||
previewBox: previewBox,
|
previewBox: previewBox,
|
||||||
eventBox: eventBox,
|
eventBox: eventBox,
|
||||||
@ -2842,10 +2843,12 @@ Loop:
|
|||||||
func (t *Terminal) renderPreviewScrollbar(yoff int, barLength int, barStart int) {
|
func (t *Terminal) renderPreviewScrollbar(yoff int, barLength int, barStart int) {
|
||||||
height := t.pwindow.Height()
|
height := t.pwindow.Height()
|
||||||
w := t.pborder.Width()
|
w := t.pborder.Width()
|
||||||
|
xw := [2]int{t.pwindow.Left(), t.pwindow.Width()}
|
||||||
redraw := false
|
redraw := false
|
||||||
if len(t.previewer.bar) != height {
|
if len(t.previewer.bar) != height || t.previewer.xw != xw {
|
||||||
redraw = true
|
redraw = true
|
||||||
t.previewer.bar = make([]bool, height)
|
t.previewer.bar = make([]bool, height)
|
||||||
|
t.previewer.xw = xw
|
||||||
}
|
}
|
||||||
xshift := -1 - t.borderWidth
|
xshift := -1 - t.borderWidth
|
||||||
if !t.activePreviewOpts.border.HasRight() {
|
if !t.activePreviewOpts.border.HasRight() {
|
||||||
|
Loading…
Reference in New Issue
Block a user