-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat: find dialog 1760 #106
Conversation
Codecov Report
@@ Coverage Diff @@
## main #106 +/- ##
==========================================
+ Coverage 75.60% 76.07% +0.47%
==========================================
Files 247 252 +5
Lines 9920 10182 +262
==========================================
+ Hits 7500 7746 +246
- Misses 2420 2436 +16
|
3e8eec5
to
0b0ad4d
Compare
@Xazin I wanted to ask you this: Currently I am using the default highlight color which comes from the editor styles to highlight found matches, should I use a different color instead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, I'm stoked for this. Could you add a handful of unit tests for the search algorithm?
Sure @a-wallen ! |
Hey Mayur, thanks for the update. If possible leave these two issues to me, I will take a look on Monday and give you an update. 👌 |
Sure! |
.../editor/editor_component/service/shortcuts/command_shortcut_events/find_replace_command.dart
Outdated
Show resolved
Hide resolved
CC @LucasXu0 |
@Xazin @MayurSMahajan Is this PR ready for merging? The CI failed. |
I'm fixing it right now and will merge in 2 minutes. (+ some, need to fix tests) |
This PR aims at creating a FInd Dialog, that is able to find string patterns in editor document.
This PR introduces three new files for implementing this feature:
find_menu_service.dart
find_replace_widget.dart
search_service.dart
Find Menu Service
This service is actually implemented by FindReplaceMenu, which is responsible for popping a Find Replace Menu onto the editor.
It is able to do so by adding a new
OverlayEntry
to the editor.Find Replace Widget
It is simply a widget component strictly used for presentation. It separates the FindMenuService from the SearchService. It describes the UI of the Find Replace Menu.
Search Service
The Heavy Logic Lifting is done by a class called SearchService. This class contains public methods like:
findAndHighlight
: finds the pattern and highlights it.navigateToMatch
: navigates between matched patterns in the vertical direction.unHighlight
: unhighlights the matches when a new pattern is searched or the find dialog is closed.It also contains a bunch of private utility methods, one particularly interesting method is the
_boyerMooreSearch
method, which implements the world-renowned Boyer Moore Search algorithm for searching the pattern in the editor.Limitations
Features Yet to be implemented