Skip to content

micro: Handle +/text search text from args #3767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luca020400
Copy link

This is a feature found in vim and commonly used
by Linux kernel test robots to give context about
warnings and/or failures.

e.g. vim +/imem_size +623 drivers/net/ipa/ipa_mem.c

The order in which the commands appear in the args
determines the order in which the "goto line:column"
and search text will be executed.

Copy link
Contributor

@Andriamanitra Andriamanitra left a comment

Choose a reason for hiding this comment

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

I think NewBufferFromFileWithCommand is a weird API to have because it's coupled to how the CLI works. It also requires changing all the call sites. Do you think it would be feasible to keep NewBufferFromFileAtLoc/NewBuffer as-is and handle moving the cursor to a match separately?

@luca020400
Copy link
Author

That's possible, but it's not that different from the current API as a whole, it would be equivalent to simply adding searchText parameter (as start location was only used for CLI already)

And if I split open & match i'd be weird to handle the save cursor option and furthermore the onBufferOpen would run before finding matches, and now you'd have start position (either from +lin:col for filename), onBufferOpen and then match, it would be very confusing to me...

Feel free to propose something, but this seemed the "sanest" model to implement to me

@dmaluka
Copy link
Collaborator

dmaluka commented Jun 8, 2025

I think NewBufferFromFileWithCommand is a weird API to have

That was my first though too, but after a closer look, it looks like quite a sane generalization of AtLoc. Also:

it's coupled to how the CLI works

Potentially we might use this concept of "command" not just in the CLI but also in some other cases at runtime, like it is used in vim (and vi, ed, sed...).

@luca020400 luca020400 force-pushed the luca/plusslash branch 2 times, most recently from d850c9a to 71aa1ec Compare June 8, 2025 11:45
This is a feature found in vim and commonly used
by Linux kernel test robots to give context about
warnings and/or failures.

e.g. vim +/imem_size +623 drivers/net/ipa/ipa_mem.c

The order in which the commands appear in the args
determines in which order the "goto line:column"
and search will be executed.
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.

3 participants