Fixed the partial-dirty blanking regression
This commit is contained in:
@@ -101,7 +101,9 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
if (dirty == DIRTY_FULL) {
|
||||
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
|
||||
} else if (dirty == DIRTY_PARTIAL) {
|
||||
if (snapshot != null && snapshot.renderRows().size() == snapshot.rows()) {
|
||||
if (!software.canPaintDirty(snapshot)) {
|
||||
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
|
||||
} else if (snapshot != null && snapshot.renderRows().size() == snapshot.rows()) {
|
||||
software.paintFullOrShifted(gc, snapshot, px, py, width, height, active);
|
||||
} else {
|
||||
software.paintDirty(gc, snapshot, px, py, width, height, active);
|
||||
@@ -679,10 +681,16 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
private long[] rowHashes = new long[0];
|
||||
private CursorState lastCursor = CursorState.none();
|
||||
private GlyphCache glyphs;
|
||||
private boolean valid;
|
||||
|
||||
private void invalidate() {
|
||||
rowHashes = new long[0];
|
||||
lastCursor = CursorState.none();
|
||||
valid = false;
|
||||
}
|
||||
|
||||
private boolean canPaintDirty(RenderStateSnapshot snapshot) {
|
||||
return valid && snapshot != null && rowHashes.length == snapshot.rows();
|
||||
}
|
||||
|
||||
private void paintFull(GraphicsContext gc, RenderStateSnapshot snapshot,
|
||||
@@ -693,6 +701,7 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
paintSnapshot(snapshot);
|
||||
drawCursor(snapshot);
|
||||
rememberSnapshot(snapshot);
|
||||
valid = true;
|
||||
} else {
|
||||
invalidate();
|
||||
}
|
||||
@@ -730,6 +739,7 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
}
|
||||
}
|
||||
lastCursor = cursor;
|
||||
valid = true;
|
||||
drawCursor(snapshot);
|
||||
drawBorder(active);
|
||||
present(gc, px, py);
|
||||
@@ -738,14 +748,9 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
private void paintDirty(GraphicsContext gc, RenderStateSnapshot snapshot,
|
||||
double px, double py, double paneWidth, double paneHeight, boolean active) {
|
||||
ensure(paneWidth, paneHeight);
|
||||
if (snapshot == null) {
|
||||
if (!canPaintDirty(snapshot)) {
|
||||
return;
|
||||
}
|
||||
if (rowHashes.length != snapshot.rows()) {
|
||||
paintFull(gc, snapshot, px, py, paneWidth, paneHeight, active);
|
||||
return;
|
||||
}
|
||||
|
||||
CursorState cursor = CursorState.from(snapshot);
|
||||
int oldCursorRow = lastCursor.viewportRow();
|
||||
int newCursorRow = cursor.viewportRow();
|
||||
@@ -766,6 +771,7 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
}
|
||||
repaintCursorRow(snapshot, newCursorRow, repainted);
|
||||
lastCursor = cursor;
|
||||
valid = true;
|
||||
drawCursor(snapshot);
|
||||
drawBorder(active);
|
||||
present(gc, px, py);
|
||||
@@ -856,13 +862,11 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
||||
continue;
|
||||
}
|
||||
int score = 0;
|
||||
int overlap = 0;
|
||||
for (int row = 0; row < rows; row++) {
|
||||
int previous = row - delta;
|
||||
if (previous < 0 || previous >= rows) {
|
||||
continue;
|
||||
}
|
||||
overlap++;
|
||||
if (currentHashes[row] == rowHashes[previous]) {
|
||||
score++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user