Skip to content
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

[ExtFilter] Fuzzy matched title segment is not highlighted #1051

Closed
stagefright5 opened this issue Nov 24, 2020 · 2 comments · Fixed by #1059
Closed

[ExtFilter] Fuzzy matched title segment is not highlighted #1051

stagefright5 opened this issue Nov 24, 2020 · 2 comments · Fixed by #1059

Comments

@stagefright5
Copy link
Contributor

stagefright5 commented Nov 24, 2020

When filter is applied with fuzzy: true, the fuzzy matched characters are not highlighted

Expected and Actual Behavior

CodePen: https://codepen.io/stagefright5/pen/xxOvMLW?editors=1010

  1. Substring match is highlighted (with fuzzy: true)
    image

  2. Fuzzy match is not highlighted

image

Steps to Reproduce the Problem

  1. apply extFilter
  2. set fuzzy: true for filter options
  3. filterNodes(str) where str is not a substring but a fuzzy match

CodePen: https://codepen.io/stagefright5/pen/xxOvMLW?editors=1010

Environment

@mar10
Copy link
Owner

mar10 commented Nov 29, 2020

This is currently not supported. If you can suggest some code/pull request, please let me know.
We can re-open this issue then...

@mar10 mar10 closed this as completed Nov 29, 2020
stagefright5 added a commit to stagefright5/fancytree that referenced this issue Dec 25, 2020
Use regex capture group to compute the indices of the
matching character and then highlight them.

closes mar10#1051
@stagefright5
Copy link
Contributor Author

@mar10 ,
I have submitted PR for this issue and #700 here: #1059
Let me know if any changes are required.

mar10 added a commit that referenced this issue Dec 27, 2020
* Changes to pkg and pkg lock files after `npm i`

* fix (ext-filter): escape regex for fuzzy filter

Escaping the `filter` directly will not work because,
it gets further split into individual characters.
So, escape each character after splitting

closes  #700

* fix (ext-filter): Highlight not working for fuzzy matched chars

Use regex capture group to compute the indices of the
matching character and then highlight them.

closes #1051

* playground for ext-filter

* add unit tests for the fuzzy match highlight fix

* simpler condition and comments

* filter test the equality of filter and highlighted chars

* cache exotic char regex in filter cb's closure

* cache exotic char only if `escapeTitles` is truthy

* Update CHANGELOG.md

Co-authored-by: Martin Wendt <github@wwwendt.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants