xterm: DECSCUSR cursor shapes; block cursor shows the character

CSI Ps SP q is stored as Terminal.cursorShape / cursorShapeBlinks (Ps 0
returns to the view's configured cursorType; RIS clears it) and reported
by DECRQSS " q". The painter draws the requested shape. A focused block
cursor now redraws the character under it in the background colour
instead of hiding it, spans both columns of a wide character, and the
underline and bar cursors are drawn in the cursor's cell (they were drawn
at the top of the terminal).

Blinking is stored but not animated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 23:30:10 +00:00
parent 31d00e057c
commit bbb2d112ed
8 changed files with 288 additions and 14 deletions
+7 -1
View File
@@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart';
import 'package:xterm/src/core/buffer/cell_offset.dart';
import 'package:xterm/src/core/buffer/range.dart';
import 'package:xterm/src/core/buffer/segment.dart';
import 'package:xterm/src/core/cell.dart';
import 'package:xterm/src/core/mouse/button.dart';
import 'package:xterm/src/core/mouse/button_state.dart';
import 'package:xterm/src/terminal.dart';
@@ -428,11 +429,16 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
}
if (_shouldShowCursor) {
final buffer = _terminal.buffer;
final cell = CellData.empty();
buffer.lines[buffer.absoluteCursorY].getCellData(buffer.cursorX, cell);
_painter.paintCursor(
canvas,
offset + cursorOffset,
cursorType: _cursorType,
// The program's DECSCUSR request wins over the configured type.
cursorType: _terminal.cursorShape ?? _cursorType,
hasFocus: _focusNode.hasFocus,
cell: _isComposingText ? null : cell,
);
}
}