mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-08 19:46:10 +01:00
Fix crash when using some unicode characters
We should never try to look at characters in a row after those actually used.
This commit is contained in:
parent
89912be500
commit
09ecd14764
1 changed files with 2 additions and 1 deletions
|
|
@ -80,6 +80,7 @@ final class TerminalRenderer {
|
|||
|
||||
TerminalRow lineObject = screen.allocateFullLineIfNecessary(screen.externalToInternalRow(row));
|
||||
final char[] line = lineObject.mText;
|
||||
final int charsUsedInLine = lineObject.getSpaceUsed();
|
||||
|
||||
int lastRunStyle = 0;
|
||||
boolean lastRunInsideCursor = false;
|
||||
|
|
@ -125,7 +126,7 @@ final class TerminalRenderer {
|
|||
measuredWidthForRun += measuredCodePointWidth;
|
||||
column += codePointWcWidth;
|
||||
currentCharIndex += charsForCodePoint;
|
||||
while (WcWidth.width(line, currentCharIndex) <= 0) {
|
||||
while (currentCharIndex < charsUsedInLine && WcWidth.width(line, currentCharIndex) <= 0) {
|
||||
// Eat combining chars so that they are treated as part of the last non-combining code point,
|
||||
// instead of e.g. being considered inside the cursor in the next run.
|
||||
currentCharIndex += Character.isHighSurrogate(line[currentCharIndex]) ? 2 : 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue