Merge branch 'worktree-agent-a9a25296deadb0eaa'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+30
-4
@@ -14,6 +14,7 @@ import 'package:xterm/src/terminal.dart';
|
||||
import 'package:xterm/src/ui/controller.dart';
|
||||
import 'package:xterm/src/ui/cursor_type.dart';
|
||||
import 'package:xterm/src/ui/painter.dart';
|
||||
import 'package:xterm/src/ui/row_pictures.dart';
|
||||
import 'package:xterm/src/ui/selection_mode.dart';
|
||||
import 'package:xterm/src/ui/terminal_size.dart';
|
||||
import 'package:xterm/src/ui/terminal_text_style.dart';
|
||||
@@ -176,6 +177,8 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
|
||||
final TerminalPainter _painter;
|
||||
|
||||
final _rows = RowPictureCache();
|
||||
|
||||
var _stickToBottom = true;
|
||||
|
||||
void _onScroll() {
|
||||
@@ -219,6 +222,13 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
_controller.removeListener(_onControllerUpdate);
|
||||
_focusNode.removeListener(_onFocusChange);
|
||||
_cursorBlinkVisible?.removeListener(markNeedsPaint);
|
||||
_rows.clear();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_rows.clear();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -461,13 +471,29 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
|
||||
final effectFirstLine = firstLine.clamp(0, lines.length - 1);
|
||||
final effectLastLine = lastLine.clamp(0, lines.length - 1);
|
||||
|
||||
// Each line is drawn from its picture, recorded again only when the
|
||||
// line changed, and settled into laid out text once it stays the same
|
||||
// (RowPictureCache).
|
||||
final generation = _painter.generation;
|
||||
_rows.beginFrame();
|
||||
for (var i = effectFirstLine; i <= effectLastLine; i++) {
|
||||
_painter.paintLine(
|
||||
canvas,
|
||||
offset.translate(0, (i * charHeight + _lineOffset).truncateToDouble()),
|
||||
lines[i],
|
||||
final line = lines[i];
|
||||
final picture = _rows.pictureOf(
|
||||
line,
|
||||
generation,
|
||||
(canvas, settled) =>
|
||||
_painter.paintLine(canvas, Offset.zero, line, paragraphs: settled),
|
||||
);
|
||||
final top = offset.translate(
|
||||
0,
|
||||
(i * charHeight + _lineOffset).truncateToDouble(),
|
||||
);
|
||||
canvas.save();
|
||||
canvas.translate(top.dx, top.dy);
|
||||
canvas.drawPicture(picture);
|
||||
canvas.restore();
|
||||
}
|
||||
_rows.trim((effectLastLine - effectFirstLine + 1) * 2 + 8);
|
||||
|
||||
if (_terminal.buffer.absoluteCursorY >= effectFirstLine &&
|
||||
_terminal.buffer.absoluteCursorY <= effectLastLine) {
|
||||
|
||||
Reference in New Issue
Block a user