feat(vim): ex command-line overlay (:w :q :wq :x :e :N, ZZ) (T-407)

Under the Vim preset, `:` opens a transient one-line ex overlay running a
fixed v1 table; ZZ runs :wq directly. Completes the last built child of the
T-403 cross-pane vim layer (T-405 part 2 gt/gT still open).

- ExLineController + parseExCommand grammar + editor-targeted executors
  (lib/kernel/src/ex_line.dart); the overlay (lib/widgets/src/ex_line_overlay
  .dart) reuses the quick-open chrome, mounts in the root_shell Stack, and
  publishes the exline.open scope flag. Unknown commands flash + stay open;
  with no active buffer every command no-ops (2026-06-13 decision).
- :q closes the active tab via editor.close on its id — the registry promotes
  the next buffer and the split self-collapses on the last (2026-06-12
  decision); :w/:wq/:x/ZZ save (+close) the active buffer.
- :e <path> seeds quick-open (new QuickOpenController.open(seed:)); :N adds the
  editor.goto-line IPC/CLI verb (reuses _offsetForLine). Goto needs caret sync:
  EditorController now handles editor.selection-changed and the editor view
  moves the caret on a selection-only change.
- `:` and ZZ are typed intents; the editor matcher and PaneKeyNav now bubble
  unhandled typed intents to the app-root Actions, so they fire from any focus.
  vim.yaml binds `:`, ZZ (shift+z shift+z), and Esc-dismiss.

Tests: parser/controller/executors, editor.goto-line daemon tests,
selection-changed (controller + view), full overlay widget test. make test
green; analyze + format clean.

Also files T-441 (drop bold from the ticket-id card label) and T-442
(sub-agent renders as 3 cards instead of one bundle) under the T-276 UI epic.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-16 11:44:48 +02:00
co-authored by Claude Opus 4.8
parent c5e54ee0ac
commit e54d5263e0
22 changed files with 1269 additions and 8 deletions
+43
View File
@@ -89,6 +89,49 @@ void main() {
expect((r.data['selection'] as Map)['start'], 8);
});
test('editor.goto-line jumps the active buffer to a 1-based line (T-407)', () async {
await File('${sandbox.path}/multi.txt').writeAsString('one\ntwo\nthree\n');
await call('editor.open', {'path': 'multi.txt'});
final r = await call('editor.goto-line', {'line': 3});
expect(r.ok, isTrue, reason: r.error?.message);
expect(r.data['line'], 3);
// Line 3 starts after 'one\n' + 'two\n' = 8 characters.
final read = await call('editor.read');
expect((read.data['selection'] as Map)['start'], 8);
});
test('editor.goto-line clamps an out-of-range line to the content end', () async {
await File('${sandbox.path}/multi.txt').writeAsString('one\ntwo\n'); // 8 chars
await call('editor.open', {'path': 'multi.txt'});
final r = await call('editor.goto-line', {'line': 999});
expect(r.ok, isTrue);
final read = await call('editor.read');
expect((read.data['selection'] as Map)['start'], 8);
});
test('editor.goto-line rejects a non-positive line', () async {
await call('editor.open', {'path': 'doc.md'});
final r = await call('editor.goto-line', {'line': 0});
expect(r.ok, isFalse);
expect(r.error!.kind, 'user_error');
});
test('editor.goto-line with no active buffer is not-found', () async {
final r = await call('editor.goto-line', {'line': 2});
expect(r.ok, isFalse);
expect(r.error!.kind, 'not_found');
});
test('CLI positional line binds to editor.goto-line (T-232)', () async {
await File('${sandbox.path}/multi.txt').writeAsString('one\ntwo\nthree\n');
await call('editor.open', {'path': 'multi.txt'});
final r = await call('editor.goto-line', {
'positional': ['2'],
});
expect(r.ok, isTrue, reason: r.error?.message);
expect(r.data['line'], 2);
});
test('editor.insert without id targets the active buffer', () async {
await call('editor.open', {'path': 'doc.md'});
final r = await call('editor.insert', {'text': 'X '});