mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 21:05:09 +00:00
Fix selection changed on terminal resize (#2306)
This commit is contained in:
parent
82791f7efc
commit
eaa0c52b45
@ -2632,18 +2632,16 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) constrain() {
|
func (t *Terminal) constrain() {
|
||||||
|
// count of items to display allowed by filtering
|
||||||
count := t.merger.Length()
|
count := t.merger.Length()
|
||||||
|
// count of lines can be displayed
|
||||||
height := t.maxItems()
|
height := t.maxItems()
|
||||||
diffpos := t.cy - t.offset
|
|
||||||
|
|
||||||
t.cy = util.Constrain(t.cy, 0, count-1)
|
t.cy = util.Constrain(t.cy, 0, count-1)
|
||||||
t.offset = util.Constrain(t.offset, t.cy-height+1, t.cy)
|
|
||||||
// Adjustment
|
minOffset := t.cy - height + 1
|
||||||
if count-t.offset < height {
|
maxOffset := util.Max(util.Min(count-height, t.cy), 0)
|
||||||
t.offset = util.Max(0, count-height)
|
t.offset = util.Constrain(t.offset, minOffset, maxOffset)
|
||||||
t.cy = util.Constrain(t.offset+diffpos, 0, count-1)
|
|
||||||
}
|
|
||||||
t.offset = util.Max(0, t.offset)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) vmove(o int, allowCycle bool) {
|
func (t *Terminal) vmove(o int, allowCycle bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user