fix(renderer): debounce renders, refactor scroll logic, track scrollintent#280
Conversation
…intent Three related improvements to output rendering: 1. Debounce concurrent render_full_session calls Problem: Rapid session switches trigger multiple redundant renders. Solution: Coalesce into one in-flight render + trailing render with latest options. 2. Refactor scroll_to_bottom conditions Convert nested if-else chain to declarative condition table for better readability and maintainability. 3. Add WinScrolled autocmd Track user scroll position to accurately detect scroll intent (whether user is at bottom or has scrolled up).
|
These accumulated organically while building persist_state—fixing bugs, cleaning up code, adding small enhancements to get the experience right. Even with LLM assistance, splitting them now would be a headache. My apologies for the bundled review. @sudo-tee |
|
The rendering debounce raises questions. Simply because the rendering is made in a way to not allow treesitter to constantly parse the buffer. Treesitter is parsing the buffer as soon as there is "time" between writes. By adding a debounce/schedule it will degrade the performace in a exponential way as the buffer grows. It's best to remove this part. |
|
Removed the debounce logic from just clarify, your concern about treesitter performance (multiple parses) was actually unrelated to this mechanism— However, the deduplication assumed all calls were for the same session. If a user quickly switched sessions (A→B), it would return the previous session's (A) Promise, causing wrong data to render. I checked my second implementation—now Happy New Year by the way |
5750eb0 to
aebd461
Compare
Thanks for the clarification. Either way I prefer not to add complexity when it's not entirely needed. I will do some tests for the tracking and scrolling behavior |
Uh oh!
There was an error while loading. Please reload this page.