Skip to content
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

Pull C0 escape sequences into its own file #461

Merged
merged 3 commits into from
Jan 11, 2017

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Jan 8, 2017

Part of #460


This is the plan for #460 but to apply it to CSI and OSC as well. Once we move the relevant code to TS we'll be able to use template literals to make the code very readable. Example:

result.key = '\x1b[1;' + (modifiers + 1) + 'C';

Would become something like:

result.key = `${CSI.START}1;${modifiers + 1}${CSI.CUF}`;

Or potentially:

result.key = csiCode(CSI.CUF, '1', modifiers + 1);

We can also look into having TS inline the constants: microsoft/TypeScript#3922 microsoft/TypeScript#3192

@parisk let me know what you think of the structure.

@Tyriar Tyriar self-assigned this Jan 8, 2017
@Tyriar Tyriar requested a review from parisk January 8, 2017 23:57
@Tyriar
Copy link
Member Author

Tyriar commented Jan 10, 2017

I'm beginning to reconsider this after spending some time redoing the parser in #462

Having C0 codes are definitely useful as they're nonsensical without it (eg. \x08 is backspace). CSI codes however are more difficult to name as they have multiple names, the information on them are probably best located within the InputHandler and the Parser itself. The CSI final letter is the best way to identify the behavior.

@parisk
Copy link
Contributor

parisk commented Jan 10, 2017

What if we use methods that will get parameters instead of attributes for CSI?

Or what if each code had multiple "children" and acted like a map?

Would such a thing work?

@Tyriar
Copy link
Member Author

Tyriar commented Jan 10, 2017

I think that's probably overkill. Check out the parser PR for what I'm thinking now, the descriptive comments and csi code names move with the implementations to InputHandler.

Also remember if it's a map they're not inlined which could cause some significant bloat when dealing with so many codes.

@Tyriar Tyriar merged commit 0b977fc into xtermjs:master Jan 11, 2017
@Tyriar Tyriar deleted the 460_escape_sequence_c0 branch January 11, 2017 04:06
@Tyriar Tyriar modified the milestone: 2.3.0 Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants