changed escape sequence for alt-arrow to work on bash on os x#417
changed escape sequence for alt-arrow to work on bash on os x#417parisk merged 2 commits intoxtermjs:masterfrom
Conversation
|
Fix for #225 |
src/xterm.js
Outdated
| // http://unix.stackexchange.com/a/108106 | ||
| if (result.key == '\x1b[1;3D') { | ||
| result.key = '\x1b[1;5D'; | ||
| result.key = '\x1bb'; |
There was a problem hiding this comment.
You can wrap this in a platform check by using if (browser.isMac). This change also fails a test which will need its own if statement.
@parisk do you expect this to break anything? I'm concerned about how #225 (comment) could not repro and other it may not behave in other shells like zsh.
There was a problem hiding this comment.
I just tested with zsh.
I actually reprod the issue with zsh as well with the old escape codes. The new escape codes actually works with both bash and zsh on my mac which actually caught me by surprise.
I will wrap the changes in the isMac check and update the tests
There was a problem hiding this comment.
@Tyriar as for the test I could tackle it in two ways.
- Add a simple if check to the tests to check the platform. downside being the test is now dependent on the platform it runs on
- Add additional tests and mock out browser check so all cases are tested regardless of platform.
What is preferable to you?
There was a problem hiding this comment.
I see that there are already some test that mock out the browser check so I will go with that for now.
|
Updated the PR. |
|
Thanks @BobReid! |
|
this still doesn't fix alt+Backspace to delete words on mac. |
|
alt+Backspace does not have a special function on my mac (bash & zsh on stock terminal and iTerm) |
|
On my tests @aliatsis what macOS version are you running currently? Also are you using the stock terminal with bash? |
|
@parisk I'm on Sierra (10.12).. it was the same in Yosemite before I upgraded. |
The terminal should be a lot faster at processing output now thanks to xtermjs/xterm.js#422 Also of note: xtermjs/xterm.js#417: changed escape sequence for alt-arrow to work on bash on os x
These are the escape sequences that make alt-arrow work on os x bash.
I have just started poking around the code base and am not super familiar with it. Any guidance on how to make this cross platform / cross shell would be appreciated.