micro-editor / micro-editor/micro

Previous search (Ctrl+p) matches left to right instead of right to left

Open
#1,226 0 comments 0 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

say I have the following in a text file, and the pipe | represents where my cursor is located
hello hello hello
hello hello hello
| hello hello hello

When I do Ctrl+f and type in hello it finds the next instance starting from my cursor, which is fine. Anytime I press Ctrl+n it goes to the next instance of hello, which is on the same line, which is also fine. Now the bug is when using Ctrl+p. Ctrl+p will search backward (previous lines), match the first instance reading from left to right instead of right to left. So say I represent the matched text with [hello] and square braces and still have the same file.

hello hello hello
hello hello hello
| hello hello hello

Ctrl+f # type in hello
Ctrl+p

#the expected result would be this
hello hello hello
hello hello [hello]
hello hello hello

#not this
hello hello hello
[hello] hello hello
hello hello hello

Version: 1.4.1
Commit hash: 1856891
Compiled on August 10, 2018

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

Reproduce the issue in micro using the Ctrl+f search followed by Ctrl+p on the three-line example, checking which earlier match is selected. Trace the Ctrl+p search entry point and its backward-match behavior; done means the nearest prior match is selected from right to left, while Ctrl+n continues to select the next match correctly.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.