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

Support "alt+enter" sending \e\r #2498

Closed
jerch opened this issue Oct 22, 2019 · 10 comments · Fixed by #2718
Closed

Support "alt+enter" sending \e\r #2498

jerch opened this issue Oct 22, 2019 · 10 comments · Fixed by #2718
Assignees
Labels
help wanted type/enhancement Features or improvements to existing features

Comments

@jerch
Copy link
Member

jerch commented Oct 22, 2019

Reminder issue coming from #2364.

@jerch jerch added the type/enhancement Features or improvements to existing features label Oct 22, 2019
@jerch jerch self-assigned this Oct 22, 2019
@kumaran-14
Copy link
Contributor

@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

@Tyriar
Copy link
Member

Tyriar commented Feb 3, 2020

@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?

@kumaran-14
Copy link
Contributor

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.

@kumaran-14
Copy link
Contributor

@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?

@Tyriar
Copy link
Member

Tyriar commented Feb 7, 2020

@kumaran-14 it needs another decset private mode so it only is enabled when the mode is active, see #2364 (review)

@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.

@kumaran-14
Copy link
Contributor

kumaran-14 commented Feb 7, 2020

@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?

@jerch
Copy link
Member Author

jerch commented Feb 7, 2020

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

@kumaran-14
Copy link
Contributor

@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 ?

@jerch
Copy link
Member Author

jerch commented Feb 11, 2020

@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.)

@PerBothner
Copy link
Contributor

PerBothner commented Feb 17, 2020

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted type/enhancement Features or improvements to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants