mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-14 14:23:47 -05:00
Minor refactoring
- Slightly more efficient processing of Options - Do not return reference type arguments that are mutated inside the function - Use util.Constrain function when appropriate
This commit is contained in:
@@ -1122,15 +1122,7 @@ func (t *Terminal) constrain() {
|
||||
diffpos := t.cy - t.offset
|
||||
|
||||
t.cy = util.Constrain(t.cy, 0, count-1)
|
||||
|
||||
if t.cy > t.offset+(height-1) {
|
||||
// Ceil
|
||||
t.offset = t.cy - (height - 1)
|
||||
} else if t.offset > t.cy {
|
||||
// Floor
|
||||
t.offset = t.cy
|
||||
}
|
||||
|
||||
t.offset = util.Constrain(t.offset, t.cy-height+1, t.cy)
|
||||
// Adjustment
|
||||
if count-t.offset < height {
|
||||
t.offset = util.Max(0, count-height)
|
||||
|
||||
Reference in New Issue
Block a user