-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
registerMarker/registerDecoration in overviewRuler does not work if invoked immediately #5214
Comments
It seems like the marker always has Waiting for the new input to be parsed before adding the marker might introduce a lot of delay (I assume I would also have to delay writing any additional lines until the parsing finishes). Is there any way to do this without waiting, or to force processing of the write buffer? |
I think your issue would be solved by using the write callback:
This allows you to execute code immediately after it's parsed. |
Thank you! I think that works. It was not clear to me from docs that this callback is actually associated with the single line/chunk being written... I assumed it might be batched with other callbacks if the terminal was processing data in batches. |
You are right - it is not associated with single line writing, it is just a callback denoting "this chunk of data is fully parsed and processed by the terminal buffer". To get "line-wise semantics" here, you'd have to chunk the data into lines upfront, and would get a callback for each line this way. |
But just to confirm, if I call write twice in a row and pass two callbacks, whenever the data is processed the callbacks will not be batched together but will immediately invoked after the corresponding data chunk is processed? e.g.
even if this processing is happening all together? (In my case the chunks happen to be lines already, but I guess this is irrelevant to the ordering question) |
Yes the callback gets triggered synchronous right after the chunk got processed. So no new chunk data will be handled yet. The input data processing happens normally fully synchronous, also see https://xtermjs.org/docs/guides/hooks/#lifecycle--execution-context-of-parser-hooks |
When writing a large batch of lines after clearing the terminal, and using
registerMarker
+registerDecoration
to render colors in the overview ruler, the decorations do not appear if all the lines are written at once. If a small delay is introduced withsetTimeout
, the decorations work properly.Additionally, a small decoration sometimes remains at the very top of the overview ruler even after the terminal is cleared.
Screen.Recording.2024-11-15.at.12.36.07.PM.mov
Details
Steps to reproduce
https://codesandbox.io/p/sandbox/xtermjs-test-forked-yxrd7j
The text was updated successfully, but these errors were encountered: