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

fix bug: patchLine, byte aligned #4526

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

solomonwzs
Copy link
Contributor

modify function patchLine, let it filled character align by byte, avoid it causing bug at fuzzy match highlights like this:

image

@fannheyward
Copy link
Member

@solomonwzs thank you for your PR, can you post an screenshot without this PR? The code is working but I don't get the issue point.

@solomonwzs
Copy link
Contributor Author

modify function patchLine, let it filled character align by byte, avoid it causing bug at fuzzy match highlights like this:

image

@fannheyward this screenshot was the screenshot without this PR. I input "ins" to do fuzzy match, but it didn't highlight the right positions.

Suppose I has a ListItem like this:

{
    label: "hello world",
    filterText: "world",
}

It set filterText option, when we do fuzzy match, it would call patchLine to patch the lable, replace the filter text with whitespace avoid match it.

In this case:

original text: "hello world" 
patch text:    "      world"

It do fuzzy match at patch text and get the match position, then highlight original text with the position data.

If the original text has utf8 character which contain more then one byte, original code would only replace it with one whitespace:

original text: "中 world"
patch text:    "  world"

When I input l, it do fuzzy match at patch text and get position 5, then highlight 5th character at original text, and length of was 3, so it would highlight o but not l.

@fannheyward fannheyward merged commit b28b8dc into neoclide:master Mar 2, 2023
chemzqm added a commit that referenced this pull request Jul 26, 2023
3dc6153 Correct spelling `resutl` to `result` (#4711)
3d14e72 chore(deps): bump word-wrap from 1.2.3 to 1.2.4 (#4706)
2280f9a chore(deps): bump semver from 7.5.0 to 7.5.2 (#4685)
1df60fc docs: fix wrong prefix of CocList command options, ref commit 1d3b424 (#4631)
537f12b fix(rpc): fix unknown function error (#4675)
2a0e554 feat(ci): test with nvim nightly (#4661)
edcc376 chore(README): improve mappings (#4510)
0df7380 fix(notify): use nvim_buf_set_lines for nvim (#4542)
5704b37 chore(exception): typo workspaceContains (#4545)
19c782e chore(yarn): upgrade dev-dependencies (#4627)
e51a7cd fix(list): fix opening an empty buffer in the help action of the extensions (#4652)
3014125 feat: add coc.preferences.tagDefinitionTimeout (#4601)
43f4daa fix(util): properly escape breakat (#4597)
628f08a fix: hide list correctly on vim (#4584)
94dc105 fix(api): Fix Buffer.getVar() for non-current buffer (#4569)
b28b8dc fix(util): patchLine, byte aligned (#4526)
79e9e04 Fix typos and grammatical errors (#4521)
59a942d docs: fix typo termainal -> terminal (#4514)
8c0d3ef fix(semanticTokens): make indexing of highlight groups more consistent (#4500)
@solomonwzs solomonwzs deleted the coclist_20230220 branch May 20, 2024 07:48
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.

None yet

2 participants