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

[Question] Micro in RAW mode #1801

Open
dimitrik-fr opened this issue Jul 31, 2020 · 2 comments
Open

[Question] Micro in RAW mode #1801

dimitrik-fr opened this issue Jul 31, 2020 · 2 comments

Comments

@dimitrik-fr
Copy link

Is there any more info to find somewhere about "raw" mode in Micro which is helping to discover Key Binding as it's seen by Micro ?

  • for example, some keys are reported as "KeyEvent: .."
  • some as "KeyRaw: ..."
  • and some as "KeyPaste: ..."

what is the difference between them all ?
which sequences are "allowed" to be used for key bindings, and which are not ?

micro 2.0.6

Thank you in advance !

Rgds, -Dimitri

@zyedidia
Copy link
Owner

zyedidia commented Aug 2, 2020

I'm not exactly sure what sort of information you are looking for. Key events occur when micro receives a sequence from the terminal that micro knows corresponds to a certain key. For example, micro knows that if the terminal sends \a, this corresponds to the user pressing Ctrl-g, so a Ctrl-g key event will be emitted when \a is received from the terminal.

Raw events occur when micro receives an escape sequence from the terminal that has been specifically bound by the user in the bindings file. The escape sequence bound in a raw event must begin with \x1b (the escape character).

A paste event occurs when micro receives pasted text from the terminal. If the terminal supports bracketed paste, and the user performs a paste through the terminal (for example Ctrl-Shift-V in gnome-terminal), the terminal will send \x1b[200~...\x1b[201~, where ... is the pasted text. Micro will parse this and return the text as a paste event. If your terminal does not support bracketed paste, the terminal will just send the paste text as a chunk of characters, and this may or may not be interpreted as a paste event or instead a series of key events depending on what the paste option is set to.

@dimitrik-fr
Copy link
Author

Thank you ! this is now much more clear !

few more questions then :

  • any reason the key raw events to be accepted as key binding must absolutely be starting by Esc (\x1b) ?
  • also, for ex. micro reports a key press as "Ctrl+]" (and \x1d) in raw mode, but when I try to bind "Ctrl-]" or "\u001d" in bindings.json file, they seems to be just ignored or not recognized, any reason ?

Rgds, -Dimitri

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

No branches or pull requests

2 participants