Skip to content

Make search result text selectable and copyable#1072

Open
saberoueslati wants to merge 1 commit into
dail8859:masterfrom
saberoueslati:worktree-issue-825-selectable-search-result-text
Open

Make search result text selectable and copyable#1072
saberoueslati wants to merge 1 commit into
dail8859:masterfrom
saberoueslati:worktree-issue-825-selectable-search-result-text

Conversation

@saberoueslati

Copy link
Copy Markdown
Contributor

Description

Closes #825

This PR makes text inside Search Results rows selectable and copyable without changing the existing copy-all behavior. Individual result text can now be selected with the mouse and copied as plain text via Ctrl+C, Edit > Copy, or the right-click context menu. The toolbar copy button still copies all search results.


Changes

src/docks/SearchResultsDock.cpp

  • Added an embedded read-only QTextEdit for individual search result rows so result text can be selected directly.
  • Added plain-text copy support for selected result text, without copying highlight formatting.
  • Added result-row context menu support for Copy and Copy Selected Line.
  • Added Copy Selected Line to the tree row context menu so right-clicking the line-number cell also supports copying the full result line.
  • Preserved double-click activation so opening/navigating to a search result still works.
  • Clears previous result-text selection when left-clicking in Search Results.
  • Updates embedded result text widget fonts when the configured editor font changes.
  • Kept the existing toolbar copy button behavior for copying all search results.

src/docks/SearchResultsDock.h

  • Added copySelectedResultText() so the main window copy action can copy selected Search Results text when appropriate.
  • Added event filtering and selection-clearing helpers for result text selection handling.

src/dialogs/MainWindow.cpp

  • Updated Edit > Copy to first copy selected Search Results text when a result-text selection exists, then fall back to the current editor copy behavior.

Manual Testing

  • Ran a search and selected part of an individual result row.
  • Verified Ctrl+C copies only the selected result text as plain text.
  • Verified Edit > Copy copies selected result text even after opening the Edit menu.
  • Verified the result text right-click menu Copy copies selected text.
  • Verified Copy Selected Line copies the full result line from the result text context menu.
  • Verified Copy Selected Line is also available when right-clicking the line-number cell.
  • Verified the toolbar copy button still copies all search results.
  • Verified double-clicking a result still navigates to the match.

Video of basic manual test below:

Screencast.from.2026-06-08.23-04-01.webm

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.

Ability to Select and Copy Text from search results

1 participant