micro icon indicating copy to clipboard operation
micro copied to clipboard

Find operations Ctrl-n and Ctrl-p do something else than documented

Open crysman opened this issue 2 years ago • 3 comments

Description of the problem or steps to reproduce

According to help defaultkeys:

| Ctrl-n    | Find next instance of current search      |
| Ctrl-p    | Find previous instance of current search  |

But micro behaves different. Both shortcuts actually invoke searching the formar/latter search regexp instead of actually finding the next/previous instance of the current term, which is much less useful, because I can achieve this by just pressing up/down arrows like in history...

Please, how do I get the intended functionality?

Specifications

$ micro --version Version: 2.0.9 $ lsb_release -d Description: Pop!_OS 22.04 LTS

additional debug

myuser@SPIN5 ~/.config/micro 15:34:48
❱ grep -H "" *.json && ls -l plug/
bindings.json:{
bindings.json:    "Alt-/": "lua:comment.comment",
bindings.json:    "CtrlUnderscore": "lua:comment.comment",
bindings.json:    "F5": "lua:wc.wordCount"
bindings.json:}
settings.json:{
settings.json:    "autoclose": false,
settings.json:    "softwrap": true,
settings.json:    "statusformatl": "$(filename) $(modified)($(line)/$(status.lines),$(col)) $(status.paste) | ft:$(opt:filetype) | $(opt:fileformat) | $(opt:encoding) | $(status.size)",
settings.json:    "statusformatr": "$(status.branch) $(status.hash) $(bind:ToggleHelp): help"
settings.json:}
total 4
drwxr-xr-x 3 myuser myuser 4096 čec 29 13:37 wc

showkey Ctrl-n prints-out FindNext

crysman avatar Jul 29 '22 13:07 crysman

I also have this issue.

cachandlerdev avatar Aug 06 '22 01:08 cachandlerdev

Make sure that you press enter to execute the search. Then afterwards (not within the prompt) pressing ctrl-n and ctrl-p should move to the next/previous occurrences. Pressing ctrl-n/p while in the prompt will cycle the search history.

zyedidia avatar Aug 06 '22 02:08 zyedidia

@zyedidia hmm, yes, this is the problem. I believe this should be fixed in help defaultkeys to be unequivocal - meaning, edit the help text accordingly. Shall I propose a particular fix and commit or you do it yourselves?

crysman avatar Aug 10 '22 13:08 crysman

Also encountered this problem. I spent more than an hour looking for a solution...

Indeed - it would be good to indicate this in the documentation.

I don't think 'ENTER' is needed at all in this case. #1980

leni8ec avatar Jan 13 '23 08:01 leni8ec