mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Spellchecker IDEA-100509 slow on large files / minor - get rid of couple interim strings
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,9 +43,10 @@ public class TextSplitter extends BaseSplitter {
|
||||
|
||||
protected void doSplit(@NotNull String text, @NotNull TextRange range, Consumer<TextRange> consumer) {
|
||||
final WordSplitter ws = WordSplitter.getInstance();
|
||||
Matcher matcher = EXTENDED_WORD_AND_SPECIAL.matcher(range.substring(text));
|
||||
Matcher matcher = EXTENDED_WORD_AND_SPECIAL.matcher(text);
|
||||
matcher.region(range.getStartOffset(), range.getEndOffset());
|
||||
while (matcher.find()) {
|
||||
TextRange found = matcherRange(range, matcher);
|
||||
TextRange found = new TextRange(matcher.start(), matcher.end());
|
||||
ws.split(text, found, consumer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,10 +39,10 @@ public class WordSplitter extends BaseSplitter {
|
||||
if (text == null || range.getLength() <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
Matcher specialMatcher = SPECIAL.matcher(range.substring(text));
|
||||
Matcher specialMatcher = SPECIAL.matcher(text);
|
||||
specialMatcher.region(range.getStartOffset(), range.getEndOffset());
|
||||
if (specialMatcher.find()) {
|
||||
TextRange found = matcherRange(range, specialMatcher);
|
||||
TextRange found = new TextRange(specialMatcher.start(), specialMatcher.end());
|
||||
addWord(consumer, true, found);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user