blinksh / blink

Blink Mobile Shell for iOS (Mosh based)
https://blink.sh
GNU General Public License v3.0
6.16k stars 577 forks source link

Some Org-mode key bindings (contains <return>) did not work as expected #1235

Open YujiShen opened 3 years ago

YujiShen commented 3 years ago

Checklist

Configuration

[Option] AS [Escape] in Blink, iPad Pro 10.5 with Smart Keyboard.

Describe the bug

Under Org-mode Emacs (Spacemacs):

  1. Hit OPTION+return will insert a new heading, this is correct.
  2. Hit CTRL+return will enter a newline: should insert a new heading at the end of the current subtree.
  3. Hit CTRL+SHIFT+return will enter a newline: should insert new TODO entry with same level as current heading.
  4. Hit OPTION+SHIFT+return will insert a new heading: should insert new TODO entry with same level as current heading.

Above behaviours are same under iTerm, unless I toggle "Report modifiers using CSI u" under Profiles->Keys. After I toggle that, only 4. OPTION+SHIFT+RETURN will not work, it will only insert a letter "u".

I am not sure whether this is a bug or a feature need to implement. If this can be implement by "Custom Presses", I would love to know how. I am also wondering if anyone know why 4. OPTION+SHIFT+RETURN does not work under iTerm.

neezer commented 2 years ago

I'm experiencing similar behavior and would love to know how to get this working. I want to write more in Org mode on my iPad but not having CTRL+RETURN work is kind of a deal-killer for me.

neezer commented 2 years ago

Ok, found what I believe to be a working solution for C-RET:

  1. Open Blink Config > Keyboard > Custom Presses
  2. Record a new shortcut for ^⏎ (Control + Enter)
  3. Choose Send Hex Code for the action.
  4. Use this code: 1B5B32373B353B31337E. This is the hex representation for this ASCII Escape Sequence: \x1b[27;5;13~, which I found on a comment on this SO answer.

Now when I'm using terminal emacs over SSH using Blink, C-RET correctly triggers org-insert-heading-respect-content.

I think the sequence above is of the Thomas Dickey's xterm flavor, eg. ESC [ 27 ; modifier ; codepoint ~.

This may also be helpful in coming up with escape sequences for the other key sequences that aren't working out-of-the-box with Blink.

It would be nice if Blink offered a more ergonomic way of specifying these special sequences, like being able to specify the escape sequence directly instead of translating to hex.