-
-
Notifications
You must be signed in to change notification settings - Fork 199
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(highlight): forward search / matching in long lines #1976
fix(highlight): forward search / matching in long lines #1976
Conversation
1de568e
to
a729e4c
Compare
Am I reading your table correctly to mean that this breaks functionality for 0.9 users? I'm not sure how I feel about breaking support for 0.9 so quickly after 0.10's release. Even our automated test runners aren't updated to support it. That said, if we already have precedent for staying on the bleeding edge, I guess it's not so bad? |
The table corresponds to the commits sequence from top to bottom. I added the test case first, which failed in nvim 0.9. This is actually a long-standing but not serious issue. |
I tested it out, and indeed, this PR completely breaks the 0.9 search highlight. This is unacceptable. |
@ollien Can you help test this pr in nvim0.9, it needs actual use for testing. And some problems are related to the platform. . . |
@xiyaowong absolutely. I won't be in front of an IDE much for the next couple of days, so my testing may be a bit superficial, but I can definitely do some more soak testing otherwise. Are there any particular cases you'd like like to see tested? Also, is this what you wanted to hold up the 1.11.5 release for? Maybe we can release that now and then push this as a minor version upgrade? |
Just use it normally
Yeah.
Agreed, this PR will still take some time to confirm. |
local view_cache = {} | ||
|
||
api.nvim_set_decoration_provider(M.viewport_changed_ns, { | ||
on_win = function() |
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.
Just for my education, what's the difference between this and the WinScrolled
autocmd? Is it just that on_win
happens before any redraw, while WinScrolled
is literally just that, scrolling?
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.
WinScrolled won't be triggered under cmdline. We also need timely and accurate viewport information neovim/neovim#28800 (comment).
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.
Huh, ok.
This comment befuddles me a little bit (how can the cursor position be different in the window than the grid?), but the reason for your change makes sense :)
Well yes the cursor position in the current window changes for incsearch but the cursor position on the grid does not and should not(implicitly). What problem does this cause?
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.
- "grid cursor" refers to the visible cursor position.
- One grid includes not only the window viewport but also components like cmdline, statuscolumn, winbar, and so on. However, vscode-neovim doesn't (can't) need these components, we only dealing with the window viewport.
We should use grid_scroll to adjust the editor, but this is not possible in vscode.
- You may notice that in the cursor manager, we only use
grid_cursor_goto
to detect changes in cursor position, but we actually use data from the viewport. - With
ext_cmdline
enabled, when entering cmdline, the visual cursor position is managed by the UI, so there is nogrid_cursor_goto
event (In Nvim0.10).
94d2236
to
59d1d51
Compare
59d1d51
to
438868b
Compare
dc36d11
to
ae28071
Compare
The latest viewport data is used in this way. That's also why this issue occasionally arises in daily use
ae28071
to
6ddecb7
Compare
I spent almost 5 hours, and couldn't find out why the failure of the virtual text highlighting test😢. |
😩😩😩 |
Ready for review&test, but not ready for merge |
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.
So far so good.
Things have mostly been fine here. There is one bug I'm seeing occasionally, which is that a highlighted keyword or curly brace will float in the editor (often very far from where I would expect it) when the window loads. I've reproduced it a couple times, but I've not managed to get a screenshot or anything of it yet |
It may be normal to have a little flaw. Many of them are caused by viewport. Is this problem brought by this pr? |
I'd never seen it before, but given I can't easily repro it, I wouldn't sweat it |
Weired. This PR is just a more comprehensive ViewPort information, how can it cause new problems |
It might not be. It could be another PR from master :) Like I said, don't sweat it |
/
incorrectly matches for long line #161Because it involves a few historical matters and dealing with hacks, I won't go into too much detail. Here are some debugging notes.
Cursor position for incsearch
Forward search matching in long line
Only tested in Nvim 0.10.
Conclusion
Highly recommend to upgrade to Nvim 0.10.