feat: Improve Sixel rendering stability by adjusting output height and anchoring behavior
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -68,7 +68,8 @@ class CliGameLoop {
|
||||
}
|
||||
}
|
||||
|
||||
stdout.write('\x1b[?25l\x1b[2J');
|
||||
// Disable Sixel scrolling mode so frames overwrite in-place.
|
||||
stdout.write('\x1b[?80l\x1b[?25l\x1b[2J');
|
||||
|
||||
_stdinSubscription = _stdinStream.listen(_handleInput);
|
||||
_stopwatch.start();
|
||||
@@ -101,7 +102,8 @@ class CliGameLoop {
|
||||
}
|
||||
|
||||
if (stdout.hasTerminal) {
|
||||
stdout.write('\x1b[0m\x1b[?25h');
|
||||
// Restore scrolling Sixel mode and cursor visibility.
|
||||
stdout.write('\x1b[0m\x1b[?80h\x1b[?25h');
|
||||
}
|
||||
|
||||
_isRunning = false;
|
||||
@@ -200,12 +202,15 @@ class CliGameLoop {
|
||||
return;
|
||||
}
|
||||
|
||||
final int safeCols = cols > 1 ? cols - 1 : cols;
|
||||
final String hint = _buildShortcutHintText();
|
||||
final String visible = hint.length > cols ? hint.substring(0, cols) : hint;
|
||||
final String padded = visible.padRight(cols);
|
||||
final String visible = hint.length > safeCols
|
||||
? hint.substring(0, safeCols)
|
||||
: hint;
|
||||
final String padded = visible.padRight(safeCols);
|
||||
|
||||
// Draw an overlay line without disturbing the renderer's cursor position.
|
||||
stdout.write('\x1b[s\x1b[1;1H\x1b[0m\x1b[2m$padded\x1b[0m\x1b[u');
|
||||
stdout.write('\x1b[s\x1b[1;1H\x1b[0m\x1b[2m\x1b[2K$padded\x1b[0m\x1b[u');
|
||||
}
|
||||
|
||||
String _buildShortcutHintText() {
|
||||
|
||||
Reference in New Issue
Block a user