Skip to content

Find panel: the review fixes missing from #1176 (#1179) - #1180

Merged
buggins merged 1 commit into
masterfrom
find-panel-review-fixes-1176
Nov 24, 2026
Merged

buggins merged 1 commit into
masterfrom
find-panel-review-fixes-1176

Conversation

@buggins

@buggins buggins commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Fixes #1179.

PR #1176 was merged without the fixes from its code review: they were in the working tree but not staged. This PR adds them, plus the fixes from their own review.

  • Reopening the panel keeps the find text. On F3 or Ctrl+F after Esc, the find text used to be replaced by the selected text. That happened when the selection became the new scope (Sel on), giving the first line of the scope. It also happened when the selection was the panel's own match, copying the case of a match found case-insensitively. The find text now stays in both cases, unless it is empty. The decision is in a static FindPanel.reopenDecision(), with a unittest; checked that it fails with the old logic.
  • The panel's own match is valid only while the text is unchanged since it was found. After an edit, a selection at the same positions is a new selection, so it becomes the scope.
  • Replace while searching back moved the caret to the start of the replacement but left the empty selection at its end. The selection now moves to the caret too, and the editor state is notified again so listeners see the final state.

Dropped from the review list: an atomic counter for EditableContent.revision. EditableContent isn't thread-safe, so it is used from one thread like the rest of the UI, and the thread-local counter stays.

Testing

  • dub test (Linux and Windows) and dub test -c console: pass, no leak lines. D-Scanner: clean.
  • dmledit console (tmux, temporary hook not committed), each ending with a normal exit and no leak lines:
    • Sel + Replace all replaces 2.
    • Esc → F3 keeps the scope.
    • A new selection + F3 becomes the scope and keeps the find text id: ; Replace all replaces exactly the 2 matches in it.
    • After typing in the text, Replace unticks Sel and replaces nothing.

🤖 Generated with Claude Code

PR #1176 was merged without its review fixes; they were not staged.

Showing the panel again (F3 or Ctrl+F after Esc) set the find text to the
selected text. That replaced it with the first line of a selection that
became the new scope, and with the case of the panel's own match found
case-insensitively. The find text now stays in both cases, unless it is
empty. The decision is FindPanel.reopenDecision(), with a unittest.

The panel's own match counts only while the text is unchanged since it was
found, so a new selection at the same positions after an edit becomes the
scope.

Replace while searching back moved the caret to the start of the
replacement but left the empty selection at its end. It is moved to the
caret too, and the editor state is notified again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@buggins buggins self-assigned this Nov 24, 2026
@buggins
buggins marked this pull request as ready for review November 24, 2026 13:02
@buggins
buggins merged commit 7935d33 into master Nov 24, 2026
13 checks passed
@buggins
buggins deleted the find-panel-review-fixes-1176 branch November 24, 2026 13:02
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 panel: the review fixes of PR #1176 are missing from master

1 participant