micro-editor / micro-editor/micro

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

Open
#2,515 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the help defaultkeys entry and reproducing the behavior with showkey Ctrl-n and showkey Ctrl-p in micro 2.0.9. Trace how FindNext and its previous-search counterpart are dispatched, then verify that Ctrl-n and Ctrl-p move to the next and previous instance of the current search term rather than changing the search history.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.