Skip to content
Myr

Make truncateQuery faster

Before adoption: this commit came in with the history the project adopted, so no landing records it.

https://github.com/junegunn/fzf/issues/4292#issuecomment-2687051731

authored by Junegunn Choi · committed by Junegunn Choi · parent e771c5d · Browse files · 1 file+5 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • https: //github.com/junegunn/fzf/issues/4292#issuecomment-2687051731

Diff stats

1 file+5 added−1 removed

  • other:+5 added−1 removed

1 file+5 added−1 removed

modified:src/terminal.go+5 added-1 removed
2284 unmodified lines
2285 }2286}22872288func (t *Terminal) truncateQuery() {2289 t.input, _ = t.trimRight(t.input, maxPatternLength)2289 // We're limiting the length of the query not to make fzf unresponsive when2290 // the user accidentally pastes a huge chunk of text. Therefore, we're not2291 // interested in the exact display width of the query. We just limit the2292 // number of runes.2293 t.input = t.input[:util.Min(len(t.input), maxPatternLength)]2294 t.cx = util.Constrain(t.cx, 0, len(t.input))2295}22962297func (t *Terminal) updatePromptOffset() ([]rune, []rune) {
4000 unmodified lines