Closed arisolt closed 2 years ago
Aren't ctrl+something
bindings usually equivalent to option+something
in Mac? Maybe you can check to see if it works with another modifier. If so, I can explain it in the readme file for others. Otherwise, create and run the following script:
<?php
system('stty cbreak -echo -crterase intr undef');
$s = fread(STDIN,32);
$l = strlen($s);
for ( $i=0 ; $i<$l ; $i++ )
echo base_convert(ord($s[$i]),10,8).' ';
system("stty sane");
After running it, it waits for one keystroke, and shows you its octal code combination. Let me know what the code is for those two bindings, and I'll add them to the application if there's no conflict with other codes.
In my opinion, it would make more sense to indicate the precise escape sequences that h-m-m is expecting, because those codes are configurable by each user in their Terminal. There are no canonical codes for a particular keybinding.
If I remove all configured keybindings in my Terminal, the script returns 177 for both Backspace and Ctrl + Backspace. Because right now my Terminal is not configured to send anything different when Backspace receives a modifier.
(Also, Delete doesn't exist on Mac keyboards, it requires a system-level hack, which complicated the situation. Let's ignore it for now :D)
Well, I don't know much about Mac :)
Ctrl+Backspace: \010 Ctrl+Delete: \033\133\63\073\065\176 Delete: \033\133\063\176
(those are octal codes)
If you need other codes, you can find them in the source under the magic_readline function.
I've made a little bit of progress. I'm still reading about escape sequences, so I'm not 100% what this means. But the following setting in my Terminal deletes backwards one word.
It may not be easy for everyone to customize their key bindings in the terminal. So, if you can think of a few sensible key combinations for those actions that would work in the Mac terminal without customization, send me the sequences, I'll add them to the program besides the existing ones, and everyone would be happy :)
Currently the following keybindings do not work on Mac:
What's the exact ANSI sequences that h-m-m expects those bindings to produce? My intention is to add those bindings manually in the terminal.
I think I've sort of worked out that ctrl+Backspace sends
[3;5~
, but that has the effect of deleting the entire content in the editor, instead of just one word. So I'm not sure if it is the correct code, or a bug.