fix cursor bug, only use java if daemon is not available

This commit is contained in:
2026-06-03 11:53:43 +02:00
parent 281e34e098
commit fd672f36f7
2 changed files with 15 additions and 1 deletions

View File

@@ -122,6 +122,7 @@
| sha256sum | cut -c1-16).jsa" | sha256sum | cut -c1-16).jsa"
makeWrapper "${pkgs.jdk25}/bin/java" "$out/bin/jprototerm" \ makeWrapper "${pkgs.jdk25}/bin/java" "$out/bin/jprototerm" \
--run 'if [ "$#" -eq 0 ]; then if [ -n "''${XDG_RUNTIME_DIR:-}" ]; then jprototermSock="$XDG_RUNTIME_DIR/jprototerm/daemon.sock"; else jprototermSock="/tmp/jprototerm-''${USER:-user}/daemon.sock"; fi; if [ -S "$jprototermSock" ] && printf "%s\n" "$(pwd)" | ${pkgs.socat}/bin/socat - UNIX-CONNECT:"$jprototermSock" >/dev/null 2>&1; then exit 0; fi; fi' \
--run 'export JPROTOTERM_HOST_LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:-}"' \ --run 'export JPROTOTERM_HOST_LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:-}"' \
--run 'cdsDir="''${XDG_CACHE_HOME:-$HOME/.cache}/jprototerm"; mkdir -p "$cdsDir"' \ --run 'cdsDir="''${XDG_CACHE_HOME:-$HOME/.cache}/jprototerm"; mkdir -p "$cdsDir"' \
--add-flags "-XX:+AutoCreateSharedArchive" \ --add-flags "-XX:+AutoCreateSharedArchive" \

View File

@@ -104,8 +104,15 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active); software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
} else if (dirty == DIRTY_PARTIAL) { } else if (dirty == DIRTY_PARTIAL) {
software.paintDirty(gc, target, snapshot, px, py, width, height, active); software.paintDirty(gc, target, snapshot, px, py, width, height, active);
} else if (software.cursorChanged(snapshot)) {
// dirty == FALSE means no cell content changed, but the cursor can still have moved,
// changed style, or toggled visibility on its own (e.g. plain cursor-left/right, or the
// hide/redraw/show dance fish does around a line edit). No row was marshalled, so diff
// against the full snapshot: it repaints just the old and new cursor rows and redraws
// the cursor. Without this the old cursor is left erased and the new one never drawn.
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
} }
// dirty == FALSE: nothing visible changed. // dirty == FALSE with an unchanged cursor: nothing visible changed.
gc.restore(); gc.restore();
kittyImageNodes = List.of(); kittyImageNodes = List.of();
} }
@@ -616,6 +623,12 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
gc.drawImage(image, px, py); gc.drawImage(image, px, py);
} }
// Whether the cursor differs from what we last drew (position, style or visibility). Used to
// catch cursor-only updates that arrive with a FALSE global dirty flag.
private boolean cursorChanged(RenderStateSnapshot snapshot) {
return !CursorState.from(snapshot).equals(lastCursor);
}
private boolean canDiff(RenderStateSnapshot snapshot) { private boolean canDiff(RenderStateSnapshot snapshot) {
return rowHashes.length == snapshot.rows() && snapshot.renderRows().size() == snapshot.rows(); return rowHashes.length == snapshot.rows() && snapshot.renderRows().size() == snapshot.rows();
} }