Skip to content

feat: search hit-highlight renderer + F3/Ctrl+F/Ctrl+H keybindings#104

Merged
tig merged 4 commits into
developfrom
copilot/find-and-replace-hit-highlight-renderer-keybinding
May 13, 2026
Merged

feat: search hit-highlight renderer + F3/Ctrl+F/Ctrl+H keybindings#104
tig merged 4 commits into
developfrom
copilot/find-and-replace-hit-highlight-renderer-keybinding

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

  • FR-003: Implement SearchHitRenderer : IBackgroundRenderer that paints viewport matches using VisualRole.Highlight attribute
  • FR-003: Auto-register/unregister renderer via SearchStrategy setter
  • FR-003: Cache matches by (document version, strategy, viewport range)
  • FR-005: Add F3 → FindNext, Shift+F3 → FindPrevious keybindings at Editor level
  • FR-005: Add Ctrl+F → FindRequested event, Ctrl+H → ReplaceRequested event at Editor level
  • FR-005: Wire ted to respond to the new events
  • FR-006: Verify invalidation on Document.Changed (driven by cache key)
  • Tests: unit tests for SearchHitRenderer, keybinding round-trip tests via AppFixture
  • CR fix: improved variable naming and selection-overlap robustness
  • Merge conflict with develop resolved (kept both _searchHitRenderer?.Invalidate() and _wrapMap = null;)

…it invalidation

- Implement SearchHitRenderer : IBackgroundRenderer that paints viewport matches
  using VisualRole.Highlight attribute
- Auto-register/unregister renderer via SearchStrategy setter
- Cache matches by (document version, strategy, viewport range)
- Add F3 → FindNext, Shift+F3 → FindPrevious keybindings
- Add Ctrl+F → FindRequested event, Ctrl+H → ReplaceRequested event
- Wire ted to respond to new events
- Invalidate hit cache on Document.Changed
- Add unit and integration tests

Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/076dfb9e-393d-4e1f-81cc-1e23ff734a1f

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement find-and-replace hit-highlight renderer and keybindings feat: search hit-highlight renderer + F3/Ctrl+F/Ctrl+H keybindings May 13, 2026
Copilot AI requested a review from tig May 13, 2026 14:37
Copilot finished work on behalf of tig May 13, 2026 14:37
@tig tig marked this pull request as ready for review May 13, 2026 14:49
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: 91c3d6c7e9

ℹ️ 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 thread src/Terminal.Gui.Editor/Rendering/SearchHitRenderer.cs
@tig
Copy link
Copy Markdown
Member

tig commented May 13, 2026

@copilot see CR feedback. Ensure there's a test that proves the CR feedback (or not) and then fix.

…aming

- Rename variables for clarity: lineStart→lineStartOffset, hitStart→hitStartOffset,
  elemStart→elemStartOffset (and their End counterparts)
- Fix selection check from fully-contained to partial-overlap, matching the same
  logic VisualLineBuilder.ApplySelection uses (robust for multi-char elements like tabs)
- Add integration test for partial-selection overlapping a search hit

Agent-Logs-Url: https://github.com/gui-cs/Editor/sessions/7a05fc57-c007-4ab4-8ab1-1096eb7e8c29

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.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 13, 2026

@copilot see CR feedback. Ensure there's a test that proves the CR feedback (or not) and then fix.

Fixed in 7fa3844. The CR flagged ambiguous variable naming and a subtle selection-overlap check issue. Changes:

  1. Selection-overlap fix: Changed the check from fully-contained (elemStart >= selStart && elemEnd <= selEnd) to partial-overlap (elemStartOffset < selEnd && elemEndOffset > selStart), matching the same logic VisualLineBuilder.ApplySelection uses. This ensures multi-character elements like TabElement that partially overlap a selection still show as selected rather than highlighted.

  2. Variable naming: Renamed lineStart/lineEnd/hitStart/hitEnd/elemStart/elemEnd to *Offset variants for clarity.

  3. New test: Added SearchHitRenderer_Partial_Selection_Overlap_Still_Uses_Active that verifies a partially-selected search hit correctly shows Active for the selected portion and Highlight for the unselected portion.

Copilot finished work on behalf of tig May 13, 2026 15:05
@tig
Copy link
Copy Markdown
Member

tig commented May 13, 2026

@copilot resolve the merge conflicts in this pull request

…eplace-hit-highlight-renderer-keybinding

# Conflicts:
#	src/Terminal.Gui.Editor/Editor.cs

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.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 13, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in fad3537. The only conflict was in Editor.cs line ~428 in OnDocumentChanged — develop added _wrapMap = null; while our branch had _searchHitRenderer?.Invalidate();. Both lines are kept. All 545 tests (411 unit + 134 integration) pass.

Copilot finished work on behalf of tig May 13, 2026 16:33
@tig tig merged commit f24ec64 into develop May 13, 2026
8 checks passed
@tig tig deleted the copilot/find-and-replace-hit-highlight-renderer-keybinding branch May 13, 2026 16:39
tig added a commit that referenced this pull request May 17, 2026
…rvey

All four beta features (find-and-replace #104, clipboard #107, word-wrap
#106, multi-caret #105) plus vertical-multi-caret #133 and syntax-theme
Phase 2 #134 have merged since the 2026-05-13 plan snapshot. Bring the
spec set back in line with develop:

- Per-feature status lines -> Done with PR/issue refs (clipboard,
  multi-caret, find-and-replace, word-wrap, vertical-multi-caret,
  syntax-theme).
- plan.md rescoped to the beta endgame: new "Done (beta)" table, a
  "Remaining for beta" that reflects no feature work is left (only
  external/verification/cut items), evidence-checked DoD boxes,
  refreshed dependency graph and header.
- decisions.md: OPEN-005 annotated as settled by syntax-theme; add
  OPEN-006 (single-line/input-mode decision).
- codex-autonomous-sprint.md: flag stale work pool.
- New specs/textview-parity-gap/spec.md: survey of TextView
  capabilities Editor lacks (autocomplete, overwrite mode,
  single-line mode, kill-ring, context menu) with dispositions;
  wired into plan.md follow-ups.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

find-and-replace: hit-highlight renderer + F3 / Ctrl+F / Ctrl+H keybindings

2 participants