Limit BufferSnapshot::surrounding_word search to 256 characters (#32016)
This is the first step to closing #16120. Part of the problem was that `surrounding_word` would search the whole line for matches with no limit. Co-authored-by: Conrad Irwin \<conrad@zed.dev\> Co-authored-by: Ben Kunkle \<ben@zed.dev\> Co-authored-by: Cole Miller \<cole@zed.dev\> Release Notes: - N/A
This commit is contained in:
parent
b9256dd469
commit
81f8e2ed4a
1 changed files with 2 additions and 2 deletions
|
@ -3283,8 +3283,8 @@ impl BufferSnapshot {
|
|||
pub fn surrounding_word<T: ToOffset>(&self, start: T) -> (Range<usize>, Option<CharKind>) {
|
||||
let mut start = start.to_offset(self);
|
||||
let mut end = start;
|
||||
let mut next_chars = self.chars_at(start).peekable();
|
||||
let mut prev_chars = self.reversed_chars_at(start).peekable();
|
||||
let mut next_chars = self.chars_at(start).take(128).peekable();
|
||||
let mut prev_chars = self.reversed_chars_at(start).take(128).peekable();
|
||||
|
||||
let classifier = self.char_classifier_at(start);
|
||||
let word_kind = cmp::max(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue