format the tree to current dart format spec

Mechanical `dart format` sweep across files that drifted from the
formatter's output (mostly trailing-comma and line-wrap differences
from a Dart SDK / formatter version bump). No semantic changes.

Caught because the pre-push gate now actually fires.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-06 22:28:51 +02:00
co-authored by Claude
parent 301322a6b0
commit f0bb2ffcce
29 changed files with 77 additions and 171 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"exported_at": "2026-05-06T20:28:25Z", "exported_at": "2026-05-06T20:28:51Z",
"decisions": [ "decisions": [
{ {
"id": "D-1", "id": "D-1",
+14 -14
View File
@@ -129,9 +129,7 @@ class _ClaudePaneState extends State<ClaudePane> {
repoRoot = (rootResp.data['path'] as String?) ?? repoRoot; repoRoot = (rootResp.data['path'] as String?) ?? repoRoot;
} }
_sessionName = widget.isPrimary _sessionName = widget.isPrimary ? primarySessionName(repoRoot) : secondarySessionName(repoRoot, widget.secondaryIndex!);
? primarySessionName(repoRoot)
: secondarySessionName(repoRoot, widget.secondaryIndex!);
final tmuxConf = await _ensureTmuxConf(); final tmuxConf = await _ensureTmuxConf();
final cols = _terminal.viewWidth; final cols = _terminal.viewWidth;
@@ -139,7 +137,8 @@ class _ClaudePaneState extends State<ClaudePane> {
var argv = <String>[ var argv = <String>[
'tmux', 'tmux',
'-L', 'clide', '-L',
'clide',
if (tmuxConf != null) ...['-f', tmuxConf], if (tmuxConf != null) ...['-f', tmuxConf],
'new-session', 'new-session',
'-A', '-A',
@@ -220,9 +219,7 @@ class _ClaudePaneState extends State<ClaudePane> {
} }
} }
case 'pane.exit': case 'pane.exit':
setState(() => _statusLine = widget.isPrimary setState(() => _statusLine = widget.isPrimary ? 'session exited — restart clide to retry' : 'session exited');
? 'session exited — restart clide to retry'
: 'session exited');
case 'pane.closed': case 'pane.closed':
_paneId = null; _paneId = null;
} }
@@ -252,10 +249,15 @@ class _ClaudePaneState extends State<ClaudePane> {
_ipc()?.request('pane.resize', args: {'id': id, 'cols': cols, 'rows': rows}); _ipc()?.request('pane.resize', args: {'id': id, 'cols': cols, 'rows': rows});
if (_sessionName != null) { if (_sessionName != null) {
Process.run('tmux', [ Process.run('tmux', [
'-L', 'clide', 'resize-window', '-L',
'-t', _sessionName!, 'clide',
'-x', '$cols', 'resize-window',
'-y', '$rows', '-t',
_sessionName!,
'-x',
'$cols',
'-y',
'$rows',
]); ]);
} }
}); });
@@ -277,9 +279,7 @@ class _ClaudePaneState extends State<ClaudePane> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final title = widget.isPrimary final title = widget.isPrimary ? 'claude — primary' : 'claude — secondary ${widget.secondaryIndex}';
? 'claude — primary'
: 'claude — secondary ${widget.secondaryIndex}';
final body = _error != null final body = _error != null
? Padding( ? Padding(
+2 -7
View File
@@ -14,8 +14,7 @@ typedef TmuxRunner = Future<ProcessResult> Function(List<String> args);
TmuxRunner tmuxRunner = _defaultRunner; TmuxRunner tmuxRunner = _defaultRunner;
Future<ProcessResult> _defaultRunner(List<String> args) => Future<ProcessResult> _defaultRunner(List<String> args) => Process.run('tmux', args);
Process.run('tmux', args);
const _socket = ['-L', 'clide']; const _socket = ['-L', 'clide'];
@@ -30,11 +29,7 @@ Future<void> killSession(String name) async {
Future<List<String>> listClideSessions() async { Future<List<String>> listClideSessions() async {
final r = await tmuxRunner([..._socket, 'list-sessions', '-F', '#{session_name}']); final r = await tmuxRunner([..._socket, 'list-sessions', '-F', '#{session_name}']);
if (r.exitCode != 0) return const []; if (r.exitCode != 0) return const [];
return (r.stdout as String) return (r.stdout as String).split('\n').map((s) => s.trim()).where((s) => s.isNotEmpty).toList();
.split('\n')
.map((s) => s.trim())
.where((s) => s.isNotEmpty)
.toList();
} }
/// Kill every secondary clide-claude session whose name begins with /// Kill every secondary clide-claude session whose name begins with
+1 -2
View File
@@ -54,8 +54,7 @@ class DaemonServer {
// Probe by trying to connect — if a live peer answers, refuse // Probe by trying to connect — if a live peer answers, refuse
// to start so we don't rip its socket out. // to start so we don't rip its socket out.
try { try {
final probe = await Socket.connect(addr, 0) final probe = await Socket.connect(addr, 0).timeout(const Duration(milliseconds: 200));
.timeout(const Duration(milliseconds: 200));
await probe.close(); await probe.close();
throw StateError('clide daemon already running at $socketPath'); throw StateError('clide daemon already running at $socketPath');
} on TimeoutException { } on TimeoutException {
+2 -4
View File
@@ -140,11 +140,9 @@ class NativePty {
// Pre-allocate error envelopes the child will write to its stdout // Pre-allocate error envelopes the child will write to its stdout
// (slave PTY → parent's master fd) before _exit, so the parent's // (slave PTY → parent's master fd) before _exit, so the parent's
// reader sees a real diagnostic instead of an indistinguishable EOF. // reader sees a real diagnostic instead of an indistinguishable EOF.
final chdirErr = 'clide: chdir failed: $workingDirectory\n' final chdirErr = 'clide: chdir failed: $workingDirectory\n'.toNativeUtf8(allocator: malloc);
.toNativeUtf8(allocator: malloc);
final chdirErrLen = chdirErr.length; final chdirErrLen = chdirErr.length;
final execveErr = 'clide: exec failed: $executable\n' final execveErr = 'clide: exec failed: $executable\n'.toNativeUtf8(allocator: malloc);
.toNativeUtf8(allocator: malloc);
final execveErrLen = execveErr.length; final execveErrLen = execveErr.length;
// Allocate ALL native memory before fork. // Allocate ALL native memory before fork.
+1 -5
View File
@@ -146,11 +146,7 @@ class PtySession {
try { try {
libc.setWinsize(masterFd, cols, rows); libc.setWinsize(masterFd, cols, rows);
final stdoutLine = await proc.stdout final stdoutLine = await proc.stdout.transform(const Utf8Decoder()).transform(const LineSplitter()).first.timeout(const Duration(seconds: 5));
.transform(const Utf8Decoder())
.transform(const LineSplitter())
.first
.timeout(const Duration(seconds: 5));
final pid = _extractPid(stdoutLine); final pid = _extractPid(stdoutLine);
final code = await proc.exitCode; final code = await proc.exitCode;
+1 -3
View File
@@ -572,9 +572,7 @@ class Buffer {
continue; continue;
} }
final line = lines[segment.line]; final line = lines[segment.line];
if (!(segment.line == range.begin.y || if (!(segment.line == range.begin.y || segment.line == 0 || line.isWrapped)) {
segment.line == 0 ||
line.isWrapped)) {
builder.write("\n"); builder.write("\n");
} }
builder.write(line.getText(segment.start, segment.end)); builder.write(line.getText(segment.start, segment.end));
@@ -48,10 +48,5 @@ class CellOffset {
int get hashCode => x.hashCode ^ y.hashCode; int get hashCode => x.hashCode ^ y.hashCode;
@override @override
bool operator ==(Object other) => bool operator ==(Object other) => identical(this, other) || other is CellOffset && runtimeType == other.runtimeType && x == other.x && y == other.y;
identical(this, other) ||
other is CellOffset &&
runtimeType == other.runtimeType &&
x == other.x &&
y == other.y;
} }
@@ -27,8 +27,7 @@ class BufferRangeLine extends BufferRange {
@override @override
bool contains(CellOffset position) { bool contains(CellOffset position) {
final self = normalized; final self = normalized;
return self.begin.isBeforeOrSame(position) && return self.begin.isBeforeOrSame(position) && self.end.isAfterOrSame(position);
self.end.isAfterOrSame(position);
} }
@override @override
+3 -10
View File
@@ -18,8 +18,7 @@ class BufferSegment {
/// Should be greater than or equal to [start]. /// Should be greater than or equal to [start].
final int? end; final int? end;
const BufferSegment(this.range, this.line, this.start, this.end) const BufferSegment(this.range, this.line, this.start, this.end) : assert((start != null && end != null) ? start <= end : true);
: assert((start != null && end != null) ? start <= end : true);
bool isWithin(CellOffset position) { bool isWithin(CellOffset position) {
if (position.y != line) { if (position.y != line) {
@@ -45,16 +44,10 @@ class BufferSegment {
} }
@override @override
int get hashCode => int get hashCode => range.hashCode ^ line.hashCode ^ start.hashCode ^ end.hashCode;
range.hashCode ^ line.hashCode ^ start.hashCode ^ end.hashCode;
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) ||
other is BufferSegment && other is BufferSegment && runtimeType == other.runtimeType && range == other.range && line == other.line && start == other.start && end == other.end;
runtimeType == other.runtimeType &&
range == other.range &&
line == other.line &&
start == other.start &&
end == other.end;
} }
+8 -24
View File
@@ -967,9 +967,7 @@ class EscapeParser {
case 7: case 7:
return handler.setAutoWrapMode(enabled); return handler.setAutoWrapMode(enabled);
case 9: case 9:
return enabled return enabled ? handler.setMouseMode(MouseMode.clickOnly) : handler.setMouseMode(MouseMode.none);
? handler.setMouseMode(MouseMode.clickOnly)
: handler.setMouseMode(MouseMode.none);
case 12: case 12:
case 13: case 13:
return handler.setCursorBlinkMode(enabled); return handler.setCursorBlinkMode(enabled);
@@ -985,37 +983,23 @@ class EscapeParser {
return handler.setAppKeypadMode(enabled); return handler.setAppKeypadMode(enabled);
case 1000: case 1000:
case 10061000: case 10061000:
return enabled return enabled ? handler.setMouseMode(MouseMode.upDownScroll) : handler.setMouseMode(MouseMode.none);
? handler.setMouseMode(MouseMode.upDownScroll)
: handler.setMouseMode(MouseMode.none);
case 1001: case 1001:
return enabled return enabled ? handler.setMouseMode(MouseMode.upDownScroll) : handler.setMouseMode(MouseMode.none);
? handler.setMouseMode(MouseMode.upDownScroll)
: handler.setMouseMode(MouseMode.none);
case 1002: case 1002:
return enabled return enabled ? handler.setMouseMode(MouseMode.upDownScrollDrag) : handler.setMouseMode(MouseMode.none);
? handler.setMouseMode(MouseMode.upDownScrollDrag)
: handler.setMouseMode(MouseMode.none);
case 1003: case 1003:
return enabled return enabled ? handler.setMouseMode(MouseMode.upDownScrollMove) : handler.setMouseMode(MouseMode.none);
? handler.setMouseMode(MouseMode.upDownScrollMove)
: handler.setMouseMode(MouseMode.none);
case 1004: case 1004:
return handler.setReportFocusMode(enabled); return handler.setReportFocusMode(enabled);
case 1005: case 1005:
return enabled return enabled ? handler.setMouseReportMode(MouseReportMode.utf) : handler.setMouseReportMode(MouseReportMode.normal);
? handler.setMouseReportMode(MouseReportMode.utf)
: handler.setMouseReportMode(MouseReportMode.normal);
case 1006: case 1006:
return enabled return enabled ? handler.setMouseReportMode(MouseReportMode.sgr) : handler.setMouseReportMode(MouseReportMode.normal);
? handler.setMouseReportMode(MouseReportMode.sgr)
: handler.setMouseReportMode(MouseReportMode.normal);
case 1007: case 1007:
return handler.setAltBufferMouseScrollMode(enabled); return handler.setAltBufferMouseScrollMode(enabled);
case 1015: case 1015:
return enabled return enabled ? handler.setMouseReportMode(MouseReportMode.urxvt) : handler.setMouseReportMode(MouseReportMode.normal);
? handler.setMouseReportMode(MouseReportMode.urxvt)
: handler.setMouseReportMode(MouseReportMode.normal);
case 1047: case 1047:
if (enabled) { if (enabled) {
handler.useAltBuffer(); handler.useAltBuffer();
+2 -4
View File
@@ -173,8 +173,7 @@ class CtrlInputHandler implements TerminalInputHandler {
final key = event.key; final key = event.key;
if (key.index >= TerminalKey.keyA.index && if (key.index >= TerminalKey.keyA.index && key.index <= TerminalKey.keyZ.index) {
key.index <= TerminalKey.keyZ.index) {
final input = key.index - TerminalKey.keyA.index + 1; final input = key.index - TerminalKey.keyA.index + 1;
return String.fromCharCode(input); return String.fromCharCode(input);
} }
@@ -200,8 +199,7 @@ class AltInputHandler implements TerminalInputHandler {
final key = event.key; final key = event.key;
if (key.index >= TerminalKey.keyA.index && if (key.index >= TerminalKey.keyA.index && key.index <= TerminalKey.keyZ.index) {
key.index <= TerminalKey.keyZ.index) {
final charCode = key.index - TerminalKey.keyA.index + 65; final charCode = key.index - TerminalKey.keyA.index + 65;
final input = [0x1b, charCode]; final input = [0x1b, charCode];
return String.fromCharCodes(input); return String.fromCharCodes(input);
@@ -68,8 +68,7 @@ class Keytab {
continue; continue;
} }
if (record.appCursorKeys != null && if (record.appCursorKeys != null && record.appCursorKeys != appCursorKeys) {
record.appCursorKeys != appCursorKeys) {
continue; continue;
} }
+2 -4
View File
@@ -69,8 +69,7 @@ class ClickMouseHandler implements TerminalMouseHandler {
switch (event.state.mouseMode) { switch (event.state.mouseMode) {
case MouseMode.clickOnly: case MouseMode.clickOnly:
// Only clicks and only the first 3 buttons are reported. // Only clicks and only the first 3 buttons are reported.
if (event.buttonState == TerminalMouseButtonState.down && if (event.buttonState == TerminalMouseButtonState.down && (event.button.id < 3)) {
(event.button.id < 3)) {
return MouseReporter.report( return MouseReporter.report(
event.button, event.button,
event.buttonState, event.buttonState,
@@ -101,8 +100,7 @@ class UpDownMouseHandler implements TerminalMouseHandler {
case MouseMode.upDownScrollDrag: case MouseMode.upDownScrollDrag:
case MouseMode.upDownScrollMove: case MouseMode.upDownScrollMove:
// Up events are never reported for mouse wheel buttons. // Up events are never reported for mouse wheel buttons.
if (event.button.isWheel && if (event.button.isWheel && event.buttonState == TerminalMouseButtonState.up) {
event.buttonState == TerminalMouseButtonState.up) {
return null; return null;
} }
return MouseReporter.report( return MouseReporter.report(
+4 -10
View File
@@ -27,14 +27,9 @@ abstract class MouseReporter {
// Normal mode only supports a maximum position of 223, while utf // Normal mode only supports a maximum position of 223, while utf
// supports positions up to 2015. Both modes send a null byte if the // supports positions up to 2015. Both modes send a null byte if the
// position exceeds that limit. // position exceeds that limit.
final col = (reportMode == MouseReportMode.normal && x > 223) || final col = (reportMode == MouseReportMode.normal && x > 223) || (reportMode == MouseReportMode.utf && x > 2015) ? '\x00' : String.fromCharCode(32 + x);
(reportMode == MouseReportMode.utf && x > 2015) final row =
? '\x00' (reportMode == MouseReportMode.normal && y > 223) || (reportMode == MouseReportMode.utf && y > 2015) ? '\x00' : String.fromCharCode(32 + y + 1);
: String.fromCharCode(32 + x);
final row = (reportMode == MouseReportMode.normal && y > 223) ||
(reportMode == MouseReportMode.utf && y > 2015)
? '\x00'
: String.fromCharCode(32 + y + 1);
return "\x1b[M$btn$col$row"; return "\x1b[M$btn$col$row";
case MouseReportMode.sgr: case MouseReportMode.sgr:
final buttonID = button.id; final buttonID = button.id;
@@ -42,8 +37,7 @@ abstract class MouseReporter {
return "\x1b[<$buttonID;$x;$y$upDown"; return "\x1b[<$buttonID;$x;$y$upDown";
case MouseReportMode.urxvt: case MouseReportMode.urxvt:
// The button ID uses the same id as to report it as in normal mode. // The button ID uses the same id as to report it as in normal mode.
final buttonID = final buttonID = 32 + (state == TerminalMouseButtonState.up ? 3 : button.id);
32 + (state == TerminalMouseButtonState.up ? 3 : button.id);
return "\x1b[$buttonID;$x;${y}M"; return "\x1b[$buttonID;$x;${y}M";
} }
} }
+1 -2
View File
@@ -50,8 +50,7 @@ class Terminal with Observable implements TerminalState, EscapeHandler {
void Function(String data)? onOutput; void Function(String data)? onOutput;
/// Function that is called when the dimensions of the terminal change. /// Function that is called when the dimensions of the terminal change.
void Function(int width, int height, int pixelWidth, int pixelHeight)? void Function(int width, int height, int pixelWidth, int pixelHeight)? onResize;
onResize;
/// The [TerminalInputHandler] used by this terminal. [defaultInputHandler] is /// The [TerminalInputHandler] used by this terminal. [defaultInputHandler] is
/// used when not specified. User of this class can provide their own /// used when not specified. User of this class can provide their own
+1 -3
View File
@@ -117,9 +117,7 @@ class TerminalController with ChangeNotifier {
@internal @internal
bool shouldSendPointerInput(PointerInput pointerInput) { bool shouldSendPointerInput(PointerInput pointerInput) {
// Always return false if pointer input is suspended. // Always return false if pointer input is suspended.
return _suspendPointerInputs return _suspendPointerInputs ? false : _pointerInputs.inputs.contains(pointerInput);
? false
: _pointerInputs.inputs.contains(pointerInput);
} }
/// Creates a new highlight on the terminal from [p1] to [p2] with the given /// Creates a new highlight on the terminal from [p1] to [p2] with the given
@@ -234,8 +234,7 @@ class CustomTextEditState extends State<CustomTextEdit> with TextInputClient {
} }
// Reset editing state if composing is done // Reset editing state if composing is done
if (_currentEditingState.composing.isCollapsed && if (_currentEditingState.composing.isCollapsed && _currentEditingState.text != _initEditingState.text) {
_currentEditingState.text != _initEditingState.text) {
_connection!.setEditingState(_initEditingState); _connection!.setEditingState(_initEditingState);
} }
} }
@@ -53,8 +53,7 @@ class TerminalGestureDetector extends StatefulWidget {
final GestureDragUpdateCallback? onDragUpdate; final GestureDragUpdateCallback? onDragUpdate;
@override @override
State<TerminalGestureDetector> createState() => State<TerminalGestureDetector> createState() => _TerminalGestureDetectorState();
_TerminalGestureDetectorState();
} }
class _TerminalGestureDetectorState extends State<TerminalGestureDetector> { class _TerminalGestureDetectorState extends State<TerminalGestureDetector> {
@@ -71,8 +70,7 @@ class _TerminalGestureDetectorState extends State<TerminalGestureDetector> {
void _handleTapDown(TapDownDetails details) { void _handleTapDown(TapDownDetails details) {
widget.onTapDown?.call(details); widget.onTapDown?.call(details);
if (_doubleTapTimer != null && if (_doubleTapTimer != null && _isWithinDoubleTapTolerance(details.globalPosition)) {
_isWithinDoubleTapTolerance(details.globalPosition)) {
// If there was already a previous tap, the second down hold/tap is a // If there was already a previous tap, the second down hold/tap is a
// double tap down. // double tap down.
widget.onDoubleTapDown?.call(details); widget.onDoubleTapDown?.call(details);
@@ -110,8 +108,7 @@ class _TerminalGestureDetectorState extends State<TerminalGestureDetector> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final gestures = <Type, GestureRecognizerFactory>{}; final gestures = <Type, GestureRecognizerFactory>{};
gestures[TapGestureRecognizer] = gestures[TapGestureRecognizer] = GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
() => TapGestureRecognizer(debugOwner: this), () => TapGestureRecognizer(debugOwner: this),
(TapGestureRecognizer instance) { (TapGestureRecognizer instance) {
instance instance
@@ -124,8 +121,7 @@ class _TerminalGestureDetectorState extends State<TerminalGestureDetector> {
}, },
); );
gestures[LongPressGestureRecognizer] = gestures[LongPressGestureRecognizer] = GestureRecognizerFactoryWithHandlers<LongPressGestureRecognizer>(
GestureRecognizerFactoryWithHandlers<LongPressGestureRecognizer>(
() => LongPressGestureRecognizer( () => LongPressGestureRecognizer(
debugOwner: this, debugOwner: this,
supportedDevices: { supportedDevices: {
@@ -141,8 +137,7 @@ class _TerminalGestureDetectorState extends State<TerminalGestureDetector> {
}, },
); );
gestures[PanGestureRecognizer] = gestures[PanGestureRecognizer] = GestureRecognizerFactoryWithHandlers<PanGestureRecognizer>(
GestureRecognizerFactoryWithHandlers<PanGestureRecognizer>(
() => PanGestureRecognizer( () => PanGestureRecognizer(
debugOwner: this, debugOwner: this,
supportedDevices: <PointerDeviceKind>{PointerDeviceKind.mouse}, supportedDevices: <PointerDeviceKind>{PointerDeviceKind.mouse},
@@ -81,9 +81,7 @@ class _TerminalGestureHandlerState extends State<TerminalGestureHandler> {
); );
} }
bool get _shouldSendTapEvent => bool get _shouldSendTapEvent => !widget.readOnly && widget.terminalController.shouldSendPointerInput(PointerInput.tap);
!widget.readOnly &&
widget.terminalController.shouldSendPointerInput(PointerInput.tap);
void _tapDown( void _tapDown(
GestureTapDownCallback? callback, GestureTapDownCallback? callback,
@@ -179,9 +177,7 @@ class _TerminalGestureHandlerState extends State<TerminalGestureHandler> {
void onDragStart(DragStartDetails details) { void onDragStart(DragStartDetails details) {
_lastDragStartDetails = details; _lastDragStartDetails = details;
details.kind == PointerDeviceKind.mouse details.kind == PointerDeviceKind.mouse ? renderTerminal.selectCharacters(details.localPosition) : renderTerminal.selectWord(details.localPosition);
? renderTerminal.selectCharacters(details.localPosition)
: renderTerminal.selectWord(details.localPosition);
} }
void onDragUpdate(DragUpdateDetails details) { void onDragUpdate(DragUpdateDetails details) {
@@ -20,8 +20,7 @@ class KeyboardVisibilty extends StatefulWidget {
KeyboardVisibiltyState createState() => KeyboardVisibiltyState(); KeyboardVisibiltyState createState() => KeyboardVisibiltyState();
} }
class KeyboardVisibiltyState extends State<KeyboardVisibilty> class KeyboardVisibiltyState extends State<KeyboardVisibilty> with WidgetsBindingObserver {
with WidgetsBindingObserver {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
+3 -7
View File
@@ -220,8 +220,7 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
} }
/// Total height of the terminal in pixels. Includes scrollback buffer. /// Total height of the terminal in pixels. Includes scrollback buffer.
double get _terminalHeight => double get _terminalHeight => _terminal.buffer.lines.length * _painter.cellSize.height;
_terminal.buffer.lines.length * _painter.cellSize.height;
/// The distance from the top of the terminal to the top of the viewport. /// The distance from the top of the terminal to the top of the viewport.
// double get _scrollOffset => _offset.pixels; // double get _scrollOffset => _offset.pixels;
@@ -423,8 +422,7 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
); );
} }
if (_terminal.buffer.absoluteCursorY >= effectFirstLine && if (_terminal.buffer.absoluteCursorY >= effectFirstLine && _terminal.buffer.absoluteCursorY <= effectLastLine) {
_terminal.buffer.absoluteCursorY <= effectLastLine) {
if (_isComposingText) { if (_isComposingText) {
_paintComposingText(canvas, offset + cursorOffset); _paintComposingText(canvas, offset + cursorOffset);
} }
@@ -519,9 +517,7 @@ class RenderTerminal extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
for (var highlight in _controller.highlights) { for (var highlight in _controller.highlights) {
final range = highlight.range?.normalized; final range = highlight.range?.normalized;
if (range == null || if (range == null || range.begin.y > lastLine || range.end.y < firstLine) {
range.begin.y > lastLine ||
range.end.y < firstLine) {
continue; continue;
} }
+2 -4
View File
@@ -21,12 +21,10 @@ class TerminalScrollGestureHandler extends StatefulWidget {
final Widget child; final Widget child;
@override @override
State<TerminalScrollGestureHandler> createState() => State<TerminalScrollGestureHandler> createState() => _TerminalScrollGestureHandlerState();
_TerminalScrollGestureHandlerState();
} }
class _TerminalScrollGestureHandlerState class _TerminalScrollGestureHandlerState extends State<TerminalScrollGestureHandler> {
extends State<TerminalScrollGestureHandler> {
var isAltBuffer = false; var isAltBuffer = false;
var _lastPointerPosition = Offset.zero; var _lastPointerPosition = Offset.zero;
@@ -18,19 +18,13 @@ Map<ShortcutActivator, Intent> get defaultTerminalShortcuts {
} }
final _defaultShortcuts = { final _defaultShortcuts = {
SingleActivator(LogicalKeyboardKey.keyC, control: true, shift: true): SingleActivator(LogicalKeyboardKey.keyC, control: true, shift: true): CopySelectionTextIntent.copy,
CopySelectionTextIntent.copy, SingleActivator(LogicalKeyboardKey.keyV, control: true): const PasteTextIntent(SelectionChangedCause.keyboard),
SingleActivator(LogicalKeyboardKey.keyV, control: true): SingleActivator(LogicalKeyboardKey.keyA, control: true): const SelectAllTextIntent(SelectionChangedCause.keyboard),
const PasteTextIntent(SelectionChangedCause.keyboard),
SingleActivator(LogicalKeyboardKey.keyA, control: true):
const SelectAllTextIntent(SelectionChangedCause.keyboard),
}; };
final _defaultAppleShortcuts = { final _defaultAppleShortcuts = {
SingleActivator(LogicalKeyboardKey.keyC, meta: true): SingleActivator(LogicalKeyboardKey.keyC, meta: true): CopySelectionTextIntent.copy,
CopySelectionTextIntent.copy, SingleActivator(LogicalKeyboardKey.keyV, meta: true): const PasteTextIntent(SelectionChangedCause.keyboard),
SingleActivator(LogicalKeyboardKey.keyV, meta: true): SingleActivator(LogicalKeyboardKey.keyA, meta: true): const SelectAllTextIntent(SelectionChangedCause.keyboard),
const PasteTextIntent(SelectionChangedCause.keyboard),
SingleActivator(LogicalKeyboardKey.keyA, meta: true):
const SelectAllTextIntent(SelectionChangedCause.keyboard),
}; };
@@ -37,11 +37,8 @@ class TerminalStyle {
return TerminalStyle( return TerminalStyle(
fontSize: textStyle.fontSize ?? _kDefaultFontSize, fontSize: textStyle.fontSize ?? _kDefaultFontSize,
height: textStyle.height ?? _kDefaultHeight, height: textStyle.height ?? _kDefaultHeight,
fontFamily: textStyle.fontFamily ?? fontFamily: textStyle.fontFamily ?? textStyle.fontFamilyFallback?.first ?? _kDefaultFontFamily,
textStyle.fontFamilyFallback?.first ?? fontFamilyFallback: textStyle.fontFamilyFallback ?? _kDefaultFontFamilyFallback,
_kDefaultFontFamily,
fontFamilyFallback:
textStyle.fontFamilyFallback ?? _kDefaultFontFamilyFallback,
); );
} }
@@ -3,8 +3,7 @@
/// A circular buffer in which elements know their index in the buffer. /// A circular buffer in which elements know their index in the buffer.
class IndexAwareCircularBuffer<T extends IndexedItem> { class IndexAwareCircularBuffer<T extends IndexedItem> {
/// Creates a new circular list with the specified [maxLength]. /// Creates a new circular list with the specified [maxLength].
IndexAwareCircularBuffer(int maxLength) IndexAwareCircularBuffer(int maxLength) : _array = List<T?>.filled(maxLength, null);
: _array = List<T?>.filled(maxLength, null);
/// The backing array for this list. Length is always equal to [maxLength]. /// The backing array for this list. Length is always equal to [maxLength].
late List<T?> _array; late List<T?> _array;
+3 -8
View File
@@ -144,12 +144,10 @@ class _TabStrip<T> extends StatelessWidget {
} }
} }
: null, : null,
onReorderTo: (draggedId) => onReorderTo: (draggedId) => controller.reorder(draggedId, i),
controller.reorder(draggedId, i),
tabHeight: tabHeight, tabHeight: tabHeight,
), ),
if (onAddRequested != null) if (onAddRequested != null) _AddButton(onTap: onAddRequested!, tabHeight: tabHeight),
_AddButton(onTap: onAddRequested!, tabHeight: tabHeight),
], ],
), ),
), ),
@@ -404,12 +402,9 @@ class _AddButton extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: hovered ? tokens.listItemHoverBackground : null, color: hovered ? tokens.listItemHoverBackground : null,
), ),
child: ClideText('+', child: ClideText('+', fontSize: clideIconStandard, color: hovered ? tokens.globalForeground : tokens.globalTextMuted),
fontSize: clideIconStandard,
color: hovered ? tokens.globalForeground : tokens.globalTextMuted),
), ),
), ),
); );
} }
} }
+4 -8
View File
@@ -31,18 +31,15 @@ void main() {
}); });
test('rejects ../etc/passwd traversal', () { test('rejects ../etc/passwd traversal', () {
expect(() => resolveUnderRoot(root, '../../../etc/passwd'), expect(() => resolveUnderRoot(root, '../../../etc/passwd'), throwsA(isA<PathOutsideRoot>()));
throwsA(isA<PathOutsideRoot>()));
}); });
test('rejects traversal that lands at filesystem root', () { test('rejects traversal that lands at filesystem root', () {
expect(() => resolveUnderRoot(root, '../'), expect(() => resolveUnderRoot(root, '../'), throwsA(isA<PathOutsideRoot>()));
throwsA(isA<PathOutsideRoot>()));
}); });
test('rejects sibling-directory traversal', () { test('rejects sibling-directory traversal', () {
expect(() => resolveUnderRoot(root, '../sibling/file'), expect(() => resolveUnderRoot(root, '../sibling/file'), throwsA(isA<PathOutsideRoot>()));
throwsA(isA<PathOutsideRoot>()));
}); });
test('allows internal `..` that stays under root', () { test('allows internal `..` that stays under root', () {
@@ -56,8 +53,7 @@ void main() {
final twin = Directory('${root.parent.path}/${root.uri.pathSegments.where((s) => s.isNotEmpty).last}_twin'); final twin = Directory('${root.parent.path}/${root.uri.pathSegments.where((s) => s.isNotEmpty).last}_twin');
try { try {
twin.createSync(); twin.createSync();
expect(() => resolveUnderRoot(root, '../${twin.uri.pathSegments.where((s) => s.isNotEmpty).last}/file'), expect(() => resolveUnderRoot(root, '../${twin.uri.pathSegments.where((s) => s.isNotEmpty).last}/file'), throwsA(isA<PathOutsideRoot>()));
throwsA(isA<PathOutsideRoot>()));
} finally { } finally {
if (twin.existsSync()) twin.deleteSync(recursive: true); if (twin.existsSync()) twin.deleteSync(recursive: true);
} }
+1 -2
View File
@@ -20,8 +20,7 @@ MultitabEntry<String> entry(String id, {bool closeable = true, bool reorderable
); );
} }
Widget body(BuildContext _, MultitabEntry<String> e) => Widget body(BuildContext _, MultitabEntry<String> e) => SizedBox(key: ValueKey('body-${e.id}'), child: Text('body:${e.payload}'));
SizedBox(key: ValueKey('body-${e.id}'), child: Text('body:${e.payload}'));
/// Stateful tap-counter body. Preserves a per-id count across rebuilds /// Stateful tap-counter body. Preserves a per-id count across rebuilds
/// in a static map so the test can assert state survival across tab /// in a static map so the test can assert state survival across tab