Skip to content

Add Shift+Enter shortcut for backward search#1091

Open
saberoueslati wants to merge 1 commit into
dail8859:masterfrom
saberoueslati:feature/1082-shift-enter-find-previous
Open

Add Shift+Enter shortcut for backward search#1091
saberoueslati wants to merge 1 commit into
dail8859:masterfrom
saberoueslati:feature/1082-shift-enter-find-previous

Conversation

@saberoueslati

Copy link
Copy Markdown
Contributor

Description

Fixes #1082

The Find/Replace dialog currently requires manually enabling Backward direction to search for the previous match. This PR adds browser-style keyboard navigation: Enter keeps its existing behavior, while Shift+Enter searches backward.

Shift+Enter searches backward regardless of the Backward direction checkbox state. In regular expression mode, where backward searching is unsupported, it falls back to a forward search.


Changes

src/dialogs/FindReplaceDialog.cpp

  • Added dialog-wide shortcuts for both Shift+Return and Shift+Enter.
  • Used Qt::WidgetWithChildrenShortcut so the shortcut works even when a button or another dialog control has focus.
  • Limited the shortcut to the Find and Replace tabs by checking whether the Find button is visible, keeping the Mark tab behavior unchanged.
  • Extracted the existing search logic into performFind(bool backwards).
  • Preserved the existing Find button behavior, including support for the Backward direction checkbox.

src/dialogs/FindReplaceDialog.h

  • Added the private performFind(bool backwards) helper declaration.

Manual test after the fix below :

Screencast.from.2026-07-13.00-52-07.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.

Find next in reverse with the shift key instead of having to check the "Backward direction" manuelly.

1 participant