Skip to content

Conversation

@mkotowski
Copy link
Contributor

(probably a little too over-engineered)

Add option to display established mnemonics for well-known escape sequences to make it easier to search for more information.

  • introduce ECMA-48, DEC, and Xterm mnemonics
  • add --mnemonics,-m flags
  • add tests for output changed by flags (raw and mnemonics)
  • pass sequence data with seqInfo to handle multiple types of info per one sequence

Further details:
The optional flag adds <MNEMONIC> between the dissected contents of the sequence and the explanation. Not displayed in situations like Text or sequences without mnemonic and when sequence's type is the same as the mnemonic (SOS, PM, …).

I believe the current PR introduces mnemonics to all currently handled sequences that have one.

Example:
Screenshot_20250309_164142

Add option to display established mnemonics for well-known escape
sequences.

  * introduce ECMA-48, DEC, and Xterm mnemonics
  * add `--mnemonics`,`-m` flags
  * add tests for output changed by flags (raw and mnemonics)
  * pass sequence data with `seqInfo` to handle multiple types of info
    per one sequence

Signed-off-by: Michał Kotowski <[email protected]>
@meowgorithm
Copy link
Member

Thanks for this, @mkotowski. Per #59, I'm converting this to a draft — if we decide to go ahead with it we'll convert it back.

@meowgorithm meowgorithm marked this pull request as draft March 10, 2025 12:51
var csiHandlers = map[int]handlerFn{
'm': handleSgr,
'c': printf("Request primary device attributes"),
'c': printWithMnemonic("DA1", "Request primary device attributes"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated but the description for DA1 should just be:

Suggested change
'c': printWithMnemonic("DA1", "Request primary device attributes"),
'c': printWithMnemonic("DA1", "Primary device attributes"),

When there is no parameters \x1b[c, it means a request for the terminal to send its primary device attributes which then responds with something like \x1b[64;1;2;3;4c, the same sequence command but with paramters.

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.

3 participants