mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 22:27:41 +00:00
Truncate the query string if it's too long
Use hard-coded limit to keep it simple. An alternative is to dynamically calculate the width of the visible area and use it as the limit, but it can cause unwanted truncation of the query on screen resize/split.
This commit is contained in:
parent
2fc7c18747
commit
1854922f0c
@ -19,9 +19,10 @@ const (
|
|||||||
readerBufferSize = 64 * 1024
|
readerBufferSize = 64 * 1024
|
||||||
|
|
||||||
// Terminal
|
// Terminal
|
||||||
initialDelay = 20 * time.Millisecond
|
initialDelay = 20 * time.Millisecond
|
||||||
initialDelayTac = 100 * time.Millisecond
|
initialDelayTac = 100 * time.Millisecond
|
||||||
spinnerDuration = 200 * time.Millisecond
|
spinnerDuration = 200 * time.Millisecond
|
||||||
|
maxPatternLength = 100
|
||||||
|
|
||||||
// Matcher
|
// Matcher
|
||||||
numPartitionsMultiplier = 8
|
numPartitionsMultiplier = 8
|
||||||
|
@ -1337,6 +1337,11 @@ func (t *Terminal) Loop() {
|
|||||||
if !doAction(action, mapkey) {
|
if !doAction(action, mapkey) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Truncate the query if it's too long
|
||||||
|
if len(t.input) > maxPatternLength {
|
||||||
|
t.input = t.input[:maxPatternLength]
|
||||||
|
t.cx = util.Constrain(t.cx, 0, maxPatternLength)
|
||||||
|
}
|
||||||
changed = string(previousInput) != string(t.input)
|
changed = string(previousInput) != string(t.input)
|
||||||
} else {
|
} else {
|
||||||
if mapkey == C.Rune {
|
if mapkey == C.Rune {
|
||||||
|
Loading…
Reference in New Issue
Block a user