-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Using Blessed instead of blessings #57
Comments
I've thought about adding something like term.ctrl('a') and term.meta('a') which returns '\x03' and '\x1ba' programmatically for comparison, so one could do a statement like |
That would be cool. A big stumbling block I had was wanting to separate output and input, but cursor queries requiring both, and needing to communicate across the two in case a cursor query read reads too many / the wrong bytes and they need to be shuttled over to key detection. I just looked at using Blessed for this and because of this current separation I have it doesn't look easy - but it might be worth giving up on keeping the two separated, or at least passing the same blessed.Terminal object in to both of them. |
I haven't made code progress, but I've written up what I want to change. @jquast Let me know if you'd prefer to be mentioned as someone other than "jquast" on http://ballingt.com/2014/11/29/key-detection-code.html |
'jquast' is just fine. I have some feedback for your open-ended questions I'll share after work. And thank you for being so kind :) |
I have to agree with him. The problem is, meta can be the same as alt, and three different things can happen with alt/meta+i depending on how the client's terminal emulator and keymap is configured.
And what if the user just pressed escape? then nothing happens, so they press the letter 'i'? Is this to be interpreted as ALT + i ? Instructing the user to re-configure their terminal emulator to be compatible with your program is not recommend. I recommend instead to use the Pity the emacs user for going through the trouble: http://www.emacswiki.org/emacs/MetaKeyProblems
It's perfectly acceptable to get only the
I try manually typing "[A" or "OA" in many interfaces at different rates -- on my desktop now: bash and irssi waits forever, doesn't care how slow I type it -- whereas vim emits a bell after 1 second. Anyway that's what the Many developers struggle with it. Best recommendation is not to present the user with the option of pressing escape. This avoids any noticeable delay.
I'm a bit on the fence about supporting these in blessed at all. I'll chew on the idea some more. I have a todo item in the code about it:
Ah yes, I never noticed. These could definitely be added. These keys have meaning for desktop controls on my machine, so it never reaches my emulator unless I disable them. |
Thanks so much for reading and feedback. https://github.com/jquast/x84 is pretty sweet. It'd be a pity to lose readline keys like meta-f and meta-b for folks for whom those work in bash, but if they're correctly identified as sequences this should be fine. For my own reference, master bpython-curtsies currently uses a lot of these: meta-left/right, meta-backspace, meta-f, meta-b, meta-., meta-r, meta-s, meta-d, meta-y, meta-t, meta-u, meta-c. Needing the delay makes sense because of the buffering issues you mention, but to clarify the current state of Curtsies:
since \x1b[ isn't a valid MBS, it wouldn't be reported, instead read would be called again - a state machine is still used, whether things came in on the same read is only used to choose the shorter to two MBSs when one starts with the other. (escape key alone instead of I'm not sure I can use |
Proposal for quite a rewrite:
|
see https://github.com/thomasballinger/curtsies/tree/switch-to-blessed for removal on keypress handling |
This would allow a lot of code to be removed:
The text was updated successfully, but these errors were encountered: