mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 07:13:48 -05:00
Make truncateQuery faster
https://github.com/junegunn/fzf/issues/4292#issuecomment-2687051731
This commit is contained in:
@@ -2286,7 +2286,11 @@ func (t *Terminal) move(y int, x int, clear bool) {
|
||||
}
|
||||
|
||||
func (t *Terminal) truncateQuery() {
|
||||
t.input, _ = t.trimRight(t.input, maxPatternLength)
|
||||
// We're limiting the length of the query not to make fzf unresponsive when
|
||||
// the user accidentally pastes a huge chunk of text. Therefore, we're not
|
||||
// interested in the exact display width of the query. We just limit the
|
||||
// number of runes.
|
||||
t.input = t.input[:util.Min(len(t.input), maxPatternLength)]
|
||||
t.cx = util.Constrain(t.cx, 0, len(t.input))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user