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

Esc+Esc+right (meta-right) not being detected? #91

Closed
thomasballinger opened this issue Jul 30, 2016 · 1 comment
Closed

Esc+Esc+right (meta-right) not being detected? #91

thomasballinger opened this issue Jul 30, 2016 · 1 comment

Comments

@thomasballinger
Copy link
Member

python > bpython

Nicholas Sweeting (S'14): @tom Ballinger do you know how to get option + arrow key word jumping in bpython?

Nicholas Sweeting (S'14): In ipython you can press option + left arrow and jump a word to the left

Nicholas Sweeting (S'14): same for right

Nicholas Sweeting (S'14): and ctrl + left to get to the beginning of the line

Tom Ballinger: works on my machine™

Tom Ballinger: oh not control though

Nicholas Sweeting (S'14): hmm odd probably a terminal setting then

Nicholas Sweeting (S'14): do you have "Use Option as Meta Key" turned on under Profiles > Keyboard ?

Nicholas Sweeting (S'14): nevermind turning that off doesn't seem to affect it

Tom Ballinger: left option as +Esc, right option as Meta

Tom Ballinger: both of those work for me

Tom Ballinger: Huh and normal option works for me too

Nicholas Sweeting (S'14): weird, I don't have any strange configs set up

Nicholas Sweeting (S'14): tried installing a fresh version too

Tom Ballinger: the one that on a mac writes alternate characters

Nicholas Sweeting (S'14): bpython version 0.15 on top of Python 3.5.2
(C) 2008-2015 Bob Farrell, Andreas Stuehrk et al. See AUTHORS for detail.

Tom Ballinger: ctrl-left and ctrl-right don't do anything though

Tom Ballinger: You might try python -m curtsies.events

Nicholas Sweeting (S'14):
b'\x1b\x1b[D'
<Esc+LEFT>

b'\x1b'

b'\x1b[C'

b'\x1b[5D'

Tom Ballinger: are they getting double-escaped maybe?

Nicholas Sweeting (S'14): it works fine in ipython and fish

Tom Ballinger:
'\x1b[1;9D'

<Esc+LEFT>

'\x1b[1;9C'
<Esc+RIGHT>
is what I get, is that output above from just hitting it once?

Nicholas Sweeting (S'14): yup

Nicholas Sweeting (S'14): I'm not in tmux or anything either

Nicholas Sweeting (S'14): hold on lemme check my keyboard replacements to make sure I'm not inserting any weird chars

Tom Ballinger: So we need to recognize \x1b\x1b[D as ESC+Left

Tom Ballinger: Oh but it did that one, we just need to at the Right one? Is option left working in bpython, but not right?

Nicholas Sweeting (S'14): neither works right now

Tom Ballinger: Maybe it's an escape key timing thing, both of

(b'\x1b\x1b[C', u'<Esc+RIGHT>'),
(b'\x1b\x1b[D', u'<Esc+LEFT>'),
are in there

Nicholas Sweeting (S'14): what I can do for now is just add something in keyboard replacements to send the codes it's expecting

Nicholas Sweeting (S'14): since it seems like it's only happening to me, I don't see any stackoverflow questions or anything on this

Nicholas Sweeting (S'14): ok I mapped Ctrl + left to \001 (ctrl+a) and Ctrl + right to \005 (crl+e) and that got jump to beginning of line and end working

Tom Ballinger: @nicholas Sweeting (S'14) Does the option stuff work in new (>5.0.0) IPython? If so I can look at Prompt Toolkit

Nicholas Sweeting (S'14): it works fine in ipyhton 5.0.0

Nicholas Sweeting (S'14): let me install master branch to get a newer version

Tom Ballinger: Is this on a macbook? And does it work in Terminal.app? wondering if there's a setting I can change to reproduce

Nicholas Sweeting (S'14): macbook with stock terminal app

Nicholas Sweeting (S'14):

b'\x1b\x1b[D'

<Esc+LEFT>

b'\x1b'

b'\x1b[C'

Nicholas Sweeting (S'14): option left and option right from python -m curtsies.events with 'User option as meta key' turned on

Nicholas Sweeting (S'14): with "use meta as option key" turned off it only sends:


b'\x1b[D'

b'\x1b[C'

Tom Ballinger: That one works in bpython presumably

Nicholas Sweeting (S'14): nope neither work

Nicholas Sweeting (S'14): which is odd

Nicholas Sweeting (S'14): jumping by word only works in fish and ipython with "use option as meta key" turned on

Nicholas Sweeting (S'14): but bpython wont word jump with it set either way

Tom Ballinger: Based on the curtsies.events output it looks like it's identifying Esc+Left just fine

Nicholas Sweeting (S'14): doens't work in bpython-curses or bpython-urwid either, but I assume those both use curtsies now anyway

Tom Ballinger: No bpython-curses is plain curses, but then that key never did anything there

Tom Ballinger: I'm pasting all this in a Curtsies issue, let me know if you think of some weird keyboard thing later

Tom Ballinger: OH and maybe update curtsies, but unlikely that matters

@thomasballinger
Copy link
Member Author

Fixed by ? (uninstalled bpython and curtsies, reinstalled, then is worked)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant