let g:n = 0 au WinScrolled * let g:n = g:n + 1 set incsearch
vim -u init_winscrolled-incsearch.vim:help:echo g:n and remember its value (should be 1)./ and type jumped. During that it should scroll window twice: at ju and after jumpe.<C-c> to abort search. It should scroll back to initial position.:echo g:n still shows the same value as before, however, it should be increased by 3.WinScrolled is emitted on every window scroll.
9.0.954
OS: EndeavourOS Linux x86_64, 6.0.10-arch2-1
Terminal: st
$TERM: st-256color
Shell: zsh 5.9
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
What would WinScrolled events do while the user is typing the search pattern? Would the same apply to WinResized?
My use case is animating any scroll. Right now WinScrolled is triggered only after accepting the search with <CR> (if top line has changed).
The expectation here is that WinScrolled is triggered after any scroll, i.e. either top line, left column, or skip column change in any window (at least within current tab). Same goes for WinResized - triggered after any window resize, i.e. width or height change (not sure if it can be applied in this issue, though).
I checked that when the search is executed then the one WinScrolled event is triggered if the topline changed. That is actually what I expect.
As far as I can tell from original example in this issue, WinScrolled is triggered only and after accepting search, not when topline changed. Whereas scroll can happen multiple times during typing search word and even after cancelling it with <C-c>, while no WinScrolled seem to be triggered.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I don't really intend to support "animating" scrolling, and certainly not by using autocommand events. I don't see how it can work anyway, since the event is triggered after the screen is updated. The text would jump around or flicker.
Sure, I don't expect you to support it. I was just answering the "What would WinScrolled events do while the user is typing the search pattern?".
At the moment I have pretty good implementation based on WinScrolled event without flickering. It doesn't seem that event is triggered after the screen is updated (at least in Neovim). And I really hope it will stay that way.
As mentioned, this won't happen when jumping around for 'incsearch'. The change to do otherwise must be properly justified, there must be a good reason for it. "expecting" isn't a reason by itself.
Probably, more explicit wording is that it was my understanding of WinScrolled documentation. Particularly, "After any window in the current tab page scrolled the text (horizontally or vertically)". I provided an example when this doesn't happen (a window scrolled but WinScrolled was not triggered): during initial phase of search with incsearch enabled.
Correct. And it will probably stay that way, since I currently see no reason to change it.
Sure, although I disagree, I respect you decisions. If you think this is final, then please feel free to close this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
What would WinScrolled events do while the user is typing the search
pattern? Would the same apply to WinResized?
I could think of a use case. Imagine someone wrote a plugin that provides some external syntax highlighting (LSP, tree-sitter etc.). For performance reasons the syntax highlighting might first be applied to the current view port only. I.e. text-properties are added only to the currently visible lines, and the rest is added later as the window is scrolled. This is certainly faster than adding all at once (but also more complicated), especially when editing a very large file with several thousand lines. If that's the case I would expect the plugin to add the remaining syntax highlighting as the window is scrolled, either through inscearch, or when the window is resized, or any other command that initiates scrolling.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
So it's consistency vs performance. Well, I would have said that users who are bothered by a plugin that significantly slows down scrolling should just stop using that plugin (or improve it). IMO, the current behavior is unexpected. WinScrolled is not triggered during inscsearch nor when pressing <C-g> or <C-t>, but on the other hand it is triggered when opening a vsplit and when closing the same split. I don't know if that's a bug but I wouldn't have expected it.
I'm curious what other users think.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
An alternative would be trigger WinScrolled on every little change, and provide some way for the consumer of the event to decide to postpone the effect.
This sounds pretty sensible to me. What about adding another value to the v:event? e.g.:
{
all: {width: 0, height: 2, leftcol: 0, topline: 1, skipcol: 0},
1003: {width: 0, height: -1, leftcol: 0, topline: 0, skipcol: 0},
1006: {width: 0, height: 1, leftcol: 0, topline: 1, skipcol: 0},
trigger: 'search'
}
Where 'trigger' is one of e.g. 'search', 'resize', 'split' etc.?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
How can any plugin base a decision on that?
Well you're suggesting that highlighting updates shouldn't necessarily happen during incsearch operations, so a plugin can very easily make a decision to not update when v.event.trigger == 'search' (or 'incsearch', or whatever).
It's also possible to let the plugin handle debouncing, which gives all control to the plugin to do as it will - sometimes debouncing may be appropriate, perhaps not always.
I'm approaching this from a plugin-author perspective, not an implementer perspective, it may not be feasible. Really, this was just an idea for how to do what you suggested in your comment to "trigger WinScrolled on every little change, and provide some way for the consumer of the event to decide to postpone the effect", which does sound like the way I'd like to be able to handle it on the plugin side.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
As always I appreciate @brammool good questions solely for narrowing the issue and @chrisbra the now maintainer certainly lives up to!
I'm not opposed to the idea of WinScrolled triggering during search, but I think @nickspoons idea of having a source field or trigger on the v:event dict is a good idea.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()