As a user, I'd like a search function to find text within the current document #99

Closed
opened 2019-11-26 01:22:10 +00:00 by asdf · 3 comments
Collaborator

As per functions in vim and less, as well as page searching found in most browsers. It's not often that I've needed to search a document in Bombadillo, but tried last night and thought it might be useful. I've written up a draft spec below for a simple implementation for your consideration.

Search is initiated via the key /.

A search pattern is entered, followed by the enter key, and if the pattern is found the document jumps to its position (displayed as closely to the middle of the screen as is possible).

n tries to find the next occurrence of the pattern, searching toward the end of a document, while N tries to find the previous occurrence, searching toward the beginning.

Searching may have some visual indications - the current search pattern, if found in the document, could be highlighted (colour inverted). Highlighting could be persistent, with all found instances highlighted, but would recommend that only the currently found pattern is highlighted, and that highlighting is cleared when any other action occurs.

Search patterns would probably be precise string match only. Additional functionality like case matching, finding whole words only, or regex searching, may be possible but not essential.

As per functions in vim and less, as well as page searching found in most browsers. It's not often that I've needed to search a document in Bombadillo, but tried last night and thought it might be useful. I've written up a draft spec below for a simple implementation for your consideration. Search is initiated via the key `/`. A search pattern is entered, followed by the enter key, and if the pattern is found the document jumps to its position (displayed as closely to the middle of the screen as is possible). `n` tries to find the next occurrence of the pattern, searching toward the end of a document, while `N` tries to find the previous occurrence, searching toward the beginning. Searching may have some visual indications - the current search pattern, if found in the document, could be highlighted (colour inverted). Highlighting could be persistent, with all found instances highlighted, but would recommend that only the currently found pattern is highlighted, and that highlighting is cleared when any other action occurs. Search patterns would probably be precise string match only. Additional functionality like case matching, finding whole words only, or regex searching, may be possible but not essential.
asdf added the
enhancement
non-urgent
labels 2019-11-26 01:22:10 +00:00
Owner

I have thought about this one and knew it would come up eventually. This will be complicated-ish. It sort of ties into the issue of allowing formatting (which we currently do not do, and in fact explicitly remove). If we can solve the issue surrounding display of styled text then I think we can make this work. I see no reason to not allow a regex string from the user (we are already including the regex library in the binary by way of the URL module, so size shouldnt be a major factor).

I have thought about this one and knew it would come up eventually. This will be complicated-ish. It sort of ties into the issue of allowing formatting (which we currently do not do, and in fact explicitly remove). If we can solve the issue surrounding display of styled text then I think we can make this work. I see no reason to not allow a regex string from the user (we are already including the regex library in the binary by way of the URL module, so size shouldnt be a major factor).
Owner

I have been thinking a lot about this. I have some ideas that should provide a similar feel to the less implementation of this feature. I do not plan on allowing regex or wildcards though. Simple find plus navigating around the found elements with n and N. I'll update more as the basic idea starts to develop.

I have been thinking a lot about this. I have some ideas that should provide a similar feel to the `less` implementation of this feature. I do _not_ plan on allowing regex or wildcards though. Simple find plus navigating around the found elements with `n` and `N`. I'll update more as the basic idea starts to develop.
sloum self-assigned this 2019-12-20 06:14:21 +00:00
Author
Collaborator

Implemented in #122. It works perfectly, thank you!

Implemented in #122. It works perfectly, thank you!
asdf closed this issue 2020-01-08 01:50:06 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#99
No description provided.