a shorter fix for console being cleared when inserting small text after a very large text (IDEA-CR-65713)

GitOrigin-RevId: f31c0e75b6c6c04632cb1e3919746b5818677374
This commit is contained in:
Peter Gromov
2020-08-03 11:05:06 +00:00
committed by intellij-monorepo-bot
parent 49c95c1410
commit e8f3e8616b
@@ -104,10 +104,10 @@ final class TokenBuffer {
// toss tokens from the beginning until size became < maxCapacity
while (size - startIndex > maxCapacity) {
TokenInfo info = tokens.getFirst();
int length = info.length() - startIndex;
if (length > size - maxCapacity - startIndex) {
int length = info.length();
if (length > size - maxCapacity) {
// slice a part of this info
startIndex += size - maxCapacity - startIndex;
startIndex = size - maxCapacity;
break;
}
startIndex = 0;