mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Spellchecker: just skip words that are too long
This commit is contained in:
@@ -121,6 +121,7 @@ public final class CompressedDictionary implements Dictionary {
|
||||
}
|
||||
try {
|
||||
UnitBitSet bs = encoder.encode(word, false);
|
||||
if (bs == null) return false;
|
||||
byte[] compressed = UnitBitSet.getBytes(bs);
|
||||
int index = -1;
|
||||
for (int i = 0; i < lengths.length; i++) {
|
||||
@@ -179,6 +180,7 @@ public final class CompressedDictionary implements Dictionary {
|
||||
String transformed = transform.transform(s);
|
||||
if (transformed != null) {
|
||||
UnitBitSet bs = encoder.encode(transformed, true);
|
||||
if (bs == null) return;
|
||||
byte[] compressed = UnitBitSet.getBytes(bs);
|
||||
dictionary.addToDictionary(compressed);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.intellij.spellchecker.compress;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
@@ -21,8 +22,9 @@ public final class Encoder {
|
||||
return alphabet;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public UnitBitSet encode(@NotNull CharSequence letters, boolean force) throws EncodingException {
|
||||
assert UnitBitSet.MAX_CHARS_IN_WORD >= letters.length() : "Word is too long ";
|
||||
if (UnitBitSet.MAX_CHARS_IN_WORD >= letters.length()) return null;
|
||||
UnitBitSet bs = new UnitBitSet();
|
||||
for (int i = 0; i < letters.length() - 1 + 1; i++) {
|
||||
char letter = letters.charAt(i);
|
||||
|
||||
Reference in New Issue
Block a user