Xterm.js: Support "alt+enter" sending `\e\r`

Created on 22 Oct 2019  Â·  10Comments  Â·  Source: xtermjs/xterm.js

Reminder issue coming from #2364.

help wanted typenhancement

All 10 comments

@Tyriar I would like to take this.
Also, Do you have plans to extend support for Caps + Enter and Shift + Enter ?
Only asking because I generally use them a lot and struggled to set it up in Konsole. But generally, most terminal emulators only support Alt + Enter

@kumaran-14 sure. On caps and shift enter, we want to support what other terminals support, I'm not sure what they are meant to do personally?

I use these key combinations for zsh-autosuggestions specific commands. But it is true that not all terminals implement this. I will implement alt-enter only.

@Tyriar I've looked at the #2364 pr thread.
file : src/common/input/Keyboard.ts

      if (ev.altKey && applicationCursorMode) {
        result.key = C0.ESC + C0.CR; // \e\r
      } else {
        result.key = C0.CR;
      }

Is these along the lines of what you had in mind?
I'm sure this is be more involved than this. Could you point me in the right direction?

@kumaran-14 it needs another decset private mode so it only is enabled when the mode is active, see https://github.com/xtermjs/xterm.js/pull/2364#pullrequestreview-287556720

@jerch is this right? Is it this one? 🤔

Ps = 1 0 3 9 ⇒ Don't send ESC when Alt modifies a key,
xterm. This disables the altSendsEscape resource.

@Tyriar Could you explain a bit more. How would I go about implementing a new private mode and handle key signals based on this mode?

@Tyriar Hmm not sure about 1039 or 1036. I think we always use Alt, then 1039 should do.

@jerch If I add a new DECSET private mode in IDecPrivateModes in the file src/common/Types.d.ts, in what way would I handle them in setModePrivate() and resetModePrivate() functions in src/inputHandlers.ts ?

@kumaran-14 Well, setMode always switches something on, resetMode switches something off. The DEC private flags are booleans indicating whether some operational mode takes place.

For DECSET 1039 I think we want it to send the leading ESC for any key+Alt combination, while for DECRST 1039 (reset) we should go with sending the key only (kinda ignoring the pressed Alt key, note that xterm sends in reset mode the 8bit variant of the key instead). Furthermore we should make DECSET 1039 being set by default. There is one more obstacle to take care of - under OSX the Alt (Meta?) might be remapped (see macOptionIsMeta).

About the 8bit key mode: We dont have that anywhere and it was no issue so far. I would not bother with it, as nowadays ppl dont know much about it and would never use it. Also it makes less sense in an unicode env. (I see only one valid use case for it - input of C1 chars. But those are somewhat ancient too, ppl again would not use it.)

I didn't see this mentioned: The Fish shell interprets Alt+Enter to enter multi-line mode.

Of the terminals I've tested, it works on gnome-terminal, Konsole, and DomTerm - but not xterm (with what I believe are default settings).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jestapinski picture jestapinski  Â·  3Comments

Tyriar picture Tyriar  Â·  4Comments

goxr3plus picture goxr3plus  Â·  3Comments

circuitry2 picture circuitry2  Â·  4Comments

LB-J picture LB-J  Â·  3Comments