mirror of
https://github.com/junegunn/fzf
synced 2026-06-09 10:03:17 +00:00
Address code scanning alerts
This commit is contained in:
+5
-1
@@ -4,6 +4,7 @@ package fzf
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -241,6 +242,9 @@ func Run(opts *Options) (int, error) {
|
|||||||
denylist = make(map[int32]struct{})
|
denylist = make(map[int32]struct{})
|
||||||
denyMutex.Unlock()
|
denyMutex.Unlock()
|
||||||
}
|
}
|
||||||
|
if opts.HeaderLines > math.MaxInt32 {
|
||||||
|
opts.HeaderLines = math.MaxInt32
|
||||||
|
}
|
||||||
headerLines := int32(opts.HeaderLines)
|
headerLines := int32(opts.HeaderLines)
|
||||||
headerUpdated := false
|
headerUpdated := false
|
||||||
patternBuilder := func(runes []rune) *Pattern {
|
patternBuilder := func(runes []rune) *Pattern {
|
||||||
@@ -467,7 +471,7 @@ func Run(opts *Options) (int, error) {
|
|||||||
terminal.UpdateCount(max(0, total-int(headerLines)), !reading, value.(*string))
|
terminal.UpdateCount(max(0, total-int(headerLines)), !reading, value.(*string))
|
||||||
if headerLines > 0 && !headerUpdated {
|
if headerLines > 0 && !headerUpdated {
|
||||||
terminal.UpdateHeader(GetItems(snapshot, int(headerLines)))
|
terminal.UpdateHeader(GetItems(snapshot, int(headerLines)))
|
||||||
headerUpdated = int32(total) >= headerLines
|
headerUpdated = total >= int(headerLines)
|
||||||
}
|
}
|
||||||
if heightUnknown && !deferred {
|
if heightUnknown && !deferred {
|
||||||
determine(!reading)
|
determine(!reading)
|
||||||
|
|||||||
+1
-1
@@ -6829,7 +6829,7 @@ func (t *Terminal) Loop() error {
|
|||||||
changed = true
|
changed = true
|
||||||
// Deselect items that are now part of the header
|
// Deselect items that are now part of the header
|
||||||
for idx := range t.selected {
|
for idx := range t.selected {
|
||||||
if idx < int32(n) {
|
if int(idx) < n {
|
||||||
delete(t.selected, idx)
|
delete(t.selected, idx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user