-
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
Add a way to plugin a custom control sequence handler #1176
Comments
@jerch how easy is this now that we have the new parser? |
Well as long as the custom escape sequence follows the CSI, OSC or DCS scheme it is a matter of writing a handler and registering it. At the current state it would still need some mechanism to expose the registering functionality since it is only propagated to |
It seems there are a couple of different ways to do it, none difficult, but we need to agree on the right API. For concreteness, let's assume we want to expose One way is to add a The problem with this approach is it hardwires the concepts of VT-style terminals (specifically OSC and CSI commands) into Terminal. How about something like the following. The idea is to add a new IVtInputHandler nterface for "VT-style terminals":
So instead of calling (As may be clear, I don't have a lot of TypeScript experience, so this may be all wrong.) |
Note my previous comment focuses on the classes and interfaces. Using
Also, rather than having
This would loop through a stack of fallback handlers until one returns true. |
@PerBothner Yes I think directly exposing Imho the tricky part starts in the handler logic, as it would need to have access to |
The attached patch works, in that it lets me do things like:
Does this seems like a good way to go? Is having a separate |
Having to
This has the advantage that it doesn't add any builtin overhead. However, it's a little clunky to use. Worse, it doesn't handler _removing) handlers well, especially if multiple addons may be added and removed independently. That argues for a traditional addHandler/removeHandler API:
|
This fixes (at least partially) issue xtermjs#1176 "Add a way to plugin a custom control sequence handler".
Story:
Notes:
Parser
andInputProcessor
but I think most of it should be pluggable from outside*
,%
, at minimum) and it is somehow expecting that these can be only prefix or only suffix, never both (should we check this? Not sure how this is related to broken escape sequence parser states #145.renderSvg(...)
,renderWhatever(...)
,setStateProp(prop, value)
,ensureBuffer(id)
, ...) the question is if these would be enough (not sure how to cleanly handle Implement double-height/width sequences (DECSWL/DECDWL/DECDHL) #1175 for example)DECSASD
/DECSCPP
/DECSNLS
that can be implemented by usingTerminal.resize
orDECSSDT
to set a new terminal "state" property (status line in this case) that can be displayed outside of terminal below the canvas if enabled in terminal propertiesI can do some work on this eventually but need to agree on the approach to take.
The text was updated successfully, but these errors were encountered: