Skip to content

Add column selection for vertical multi-caret#142

Merged
tig merged 19 commits into
developfrom
copilot/vertical-multi-caret-column-selection
May 19, 2026
Merged

Add column selection for vertical multi-caret#142
tig merged 19 commits into
developfrom
copilot/vertical-multi-caret-column-selection

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

  • Fetch full history and latest develop safely
  • Merge latest develop into the PR branch and resolve conflicts in place
  • Validate the resolved branch with build/format and targeted integration tests
  • Commit and push the merge resolution
  • Reply to the new PR comment with the resolving commit

Copilot AI and others added 3 commits May 17, 2026 07:39
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/7084fa04-ac77-4d3d-94f6-b5e7835d8bf2

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/7084fa04-ac77-4d3d-94f6-b5e7835d8bf2

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/7084fa04-ac77-4d3d-94f6-b5e7835d8bf2

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement column selection during drag for vertical multi-caret Add column selection for vertical multi-caret May 17, 2026
Copilot finished work on behalf of tig May 17, 2026 07:51
Copilot AI requested a review from tig May 17, 2026 07:51
@tig
Copy link
Copy Markdown
Member

tig commented May 17, 2026

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 5 commits May 17, 2026 18:53
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/0e8e70c4-b347-47a0-a400-df1ba195631f

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/0e8e70c4-b347-47a0-a400-df1ba195631f

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/0e8e70c4-b347-47a0-a400-df1ba195631f

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/0e8e70c4-b347-47a0-a400-df1ba195631f

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 17, 2026

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and pushed the updated branch. The true develop merge commit is 4e2cfe8, with follow-up validation cleanups through 9531cd8.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.jetbrains.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/jetbrains.resharper.globaltools/2026.1.1/tools/net8.0/any/cleanupcode.unix.runtimeconfig.json /home/REDACTED/.nuget/packages/jetbrains.resharper.globaltools/2026.1.1/tools/net8.0/any/cleanupcode.exe Terminal.Gui.Editor.slnx --include=src/Terminal.Gui.Editor/Editor.Drawing.cs;src/Terminal.Gui.Editor/Editor.Keyboard.cs;src/Terminal.Gui.Editor/Editor.Mouse.cs;src/Terminal.Gui.Editor/Editor.MultiCaret.cs;src/Terminal.Gui.Editor/Editor.cs;tests/Terminal.Gui.Editor.IntegrationTest (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of tig May 17, 2026 19:02
@tig
Copy link
Copy Markdown
Member

tig commented May 18, 2026

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 3 commits May 18, 2026 03:17
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/6e670ead-33a2-45df-a2cc-d33941caef6e

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/6e670ead-33a2-45df-a2cc-d33941caef6e

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 18, 2026

@copilot resolve the merge conflicts in this pull request

Resolved the latest merge conflicts and pushed the branch. The true develop merge commit is ffbfcfe, with follow-up validation cleanup in bf33894.

Copilot finished work on behalf of tig May 18, 2026 03:22
tig and others added 2 commits May 18, 2026 20:07
A keyboard column-select gesture (Ctrl+Shift+Alt+Arrow/Page) tracks its
anchor in _keyboardColumnSelectionAnchorOffset. That field was reset only
by ClearAdditionalCarets() (the Esc / mouse / rebuild path), not by
ClearAdditionalCaretSelections() (the post-edit collapse path used by all
four multi-caret edit commands). Typing over a keyboard column selection
therefore left the anchor stale: the next Ctrl+Shift+Alt+Arrow resumed
from the pre-edit offset/column/row-delta and rebuilt the old column on
the now-edited document instead of restarting from the caret.

Reset the anchor in ClearAdditionalCaretSelections() so an edit ends the
gesture, symmetric with the Esc path.

Regression test (red->green): without the fix, type-over then re-extend
produces "ay\nay\nabcd" (stale 2-row column corrupts two rows); with the
fix it produces "axy\naxd\nabcd" (single row, restarted from caret).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AnsiSnapshot.Verify captures the screen as pure ANSI via IDriver.ToAnsi()
into a __snapshots__/*.ans golden. ToAnsi() emits exactly the escape
stream that recreates the screen (truecolor/bold/reverse/blink/layout),
excluding the non-deterministic terminal cursor, so `cat <file>.ans`
reproduces the look and snapshots stay stable. On mismatch the failure
prints the plain-text render inline and writes a .ans.actual sibling, so
an agent can self-verify the look without a human eyeballing the app.
UPDATE_SNAPSHOTS=1 accepts an intended change; SNAPSHOT_DIR overrides root.

Inject adds deterministic mouse gestures (Click, multi-waypoint AltDrag)
with fixed monotonic timestamps. EditorSnapshotTests records a minimal
golden and guards ToAnsi() determinism.

*.ans is marked binary in .gitattributes — they are CRLF escape blobs and
core.autocrlf would corrupt both the byte compare and `cat` fidelity.

A Testing/README.md documents the workflow and the rules that bite;
CLAUDE.md now points every agent at it and makes look-verification
mandatory for render changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
EditorColumnSelectionTests drives the real input pipeline (Inject.AltDrag,
keyboard chords) for the column-selection feature and asserts both the
semantics (Document.Text, CaretOffset, HasSelection, AdditionalCaretOffsets,
single undo scope) and the look (ANSI snapshot). Covers: Alt+drag down /
reversed / zero-extent / short-line clamp / multi-waypoint rebuild /
collapse-on-plain-click; keyboard Right+Down / PageDown / Left-past-anchor /
Esc-collapse; type-then-single-undo.

Dogfooding the goldens caught a real test bug: the short-line test
snapshotted before the post-type render, capturing the pre-type frame;
fixed to render after the edit so the golden proves no padding is written.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tig added a commit that referenced this pull request May 19, 2026
Adds the AnsiSnapshot harness (IDriver.ToAnsi() golden-file capture; see
gui-cs/Editor PR #142 and gui-cs/Terminal.Gui PR #5343) and a test that
pins DrawSingleLineFlat: with Multiline = false a multi-line document
flattens onto one row with each newline rendered as a visible ⏎ glyph.
The golden reproduces the exact look (`cat` the .ans). *.ans is marked
binary in .gitattributes so core.autocrlf cannot corrupt the compare.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI failed on ubuntu/macos (passed on windows): TG's OutputBase.ToAnsi
separates rows with StringBuilder.AppendLine() == Environment.NewLine,
which is CRLF on Windows and LF elsewhere. Goldens recorded on Windows
(CRLF) could never match a Linux/macOS render (LF), and *.ans is committed
binary so git did not mask it.

AnsiSnapshot now normalizes both the captured ToAnsi() and the on-disk
golden to \n before comparing, and writes goldens LF. cat fidelity is
unaffected (terminals map LF->CRLF via ONLCR). All goldens re-recorded as
LF; *.ans stays binary so Windows core.autocrlf cannot reintroduce CRLF.
README updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tig added a commit that referenced this pull request May 19, 2026
Same fix as gui-cs/Editor PR #142: TG's ToAnsi uses Environment.NewLine
for row breaks, so a Windows-recorded golden fails on Linux/macOS CI.
AnsiSnapshot now normalizes capture + golden to \n; golden re-recorded LF.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tig tig marked this pull request as ready for review May 19, 2026 02:32
@tig
Copy link
Copy Markdown
Member

tig commented May 19, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a59c89715

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +348 to +350
_selectionAnchor = CreateSelectionAnchor (anchorOffset);
RefreshSelectionAnchorMovement ();
SelectionChanged?.Invoke (this, EventArgs.Empty);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear the primary selection when dismissing a column block

When a column selection has a horizontal extent, SetPrimaryColumnSelection() leaves the primary row selected; pressing Esc then goes through OnKeyDownNotHandledClearAdditionalCarets(), which removes only the additional carets and leaves this primary selection highlighted/active. That means Esc does not collapse the column selection back to a single caret as documented in specs/vertical-multi-caret/spec.md and Docs/Help/multi-caret.md, and the next typed character still replaces the primary row's selected text after the user has dismissed multi-caret mode.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Co-authored-by: tig <585482+tig@users.noreply.github.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@tig tig merged commit 14c3a8c into develop May 19, 2026
@tig tig deleted the copilot/vertical-multi-caret-column-selection branch May 19, 2026 02:39
Copilot stopped work on behalf of tig due to an error May 19, 2026 02:39
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.

vertical-multi-caret follow-up: column selection during drag + render additional-caret selections

2 participants