Skip to content

panel: make Up/Down cycle through matches during quick search#5068

Open
karpovilia wants to merge 1 commit intoMidnightCommander:masterfrom
karpovilia:fix/quicksearch-arrow-navigation
Open

panel: make Up/Down cycle through matches during quick search#5068
karpovilia wants to merge 1 commit intoMidnightCommander:masterfrom
karpovilia:fix/quicksearch-arrow-navigation

Conversation

@karpovilia
Copy link

@karpovilia karpovilia commented Mar 15, 2026

Proposed changes

Add two new panel actions SearchNext and SearchPrev that cycle through files matching the current quick search pattern, with wrap-around. These actions are only active while quick search is running.

By default, SearchNext is bound to Ctrl+S (same key that starts/continues the search), and SearchPrev has no default binding. Both can be customized in the [Panel] section of the keymap file.

This follows the existing mc convention of using symbolic action names bound through keymap files, rather than hardcoding specific keys.

Checklist

  • I have referenced the issue(s) resolved by this PR (if any)
  • I have signed-off my contribution with git commit --amend -s
  • Lint and unit tests pass locally with my changes (make indent && make check)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@github-actions github-actions bot added needs triage Needs triage by maintainers prio: medium Has the potential to affect progress labels Mar 15, 2026
@github-actions github-actions bot added this to the Future Releases milestone Mar 15, 2026
@karpovilia karpovilia force-pushed the fix/quicksearch-arrow-navigation branch from 72a3d61 to c6b090f Compare March 15, 2026 00:55
@mc-worker
Copy link
Contributor

BTW, in the active quick search mode, pressing of ctrl-s or alt-s moves you to the next match.

Please remove NEWS file from your PRs. This file is created from the wiki page in the release process.

Copy link
Contributor

@egmontkob egmontkob left a comment

Choose a reason for hiding this comment

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

When quick search is NOT active, Space marks the current file
and Backspace navigates to the parent directory.

You make multiple unrelated changes. They should preferably go to separate commits.

I truly dislike this particular change, I expect Space to act like a Space (see also freshly filed #5072). We already have two different shortcuts (Insert and Ctrl+T) for toggling the file, we don't need a third one.

Okay, I misunderstood your change, I thought you'd only do this if the command line is empty. You always do it, so I literally cannot type a command line containing a space, nor fix a mistake I made while typing. This is outright unacceptable.

Even if only at empty command line, I'd be against this feature. I want to be able to start a command with a space. And I want to be able to remove a command line by long-pressing Backspace where of course I won't be able to release it at the very exact moment it's erased all the letters.

int res = MSG_HANDLED;

/* When quick search is active, Up/Down cycle through matches instead of exiting search */
if (panel->quick_search.active && (command == CK_Up || command == CK_Down))
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe a better thing to do would be to add two new symbolic names e.g. CK_Prev/Next_Match or so, and bind them in mc.*.keymap. Maybe some users want to map it to different keys.

Add two new panel actions CK_SearchNext and CK_SearchPrev that cycle
through files matching the current quick search pattern, with
wrap-around. These are only active while quick search is running.

By default, SearchNext is bound to Ctrl+S (same key that starts the
search), and SearchPrev has no default binding. Both can be
customized in the [Panel] section of the keymap file.

This approach follows the existing mc convention of using symbolic
action names bound through keymap files, rather than hardcoding keys.

Signed-off-by: Ilia Karpov <iakarpov@edu.hse.ru>
Signed-off-by: ki <karpovilia@gmail.com>
@karpovilia karpovilia force-pushed the fix/quicksearch-arrow-navigation branch from c6b090f to b56af9e Compare March 16, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Needs triage by maintainers prio: medium Has the potential to affect progress

Development

Successfully merging this pull request may close these issues.

3 participants