-
Notifications
You must be signed in to change notification settings - Fork 43
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
OS X input handling in prompts doesn't support backspace #61
Comments
Hi! Thanks for noticing this! I'm using curses.textpad.Textbox for handling the prompts. Seems like it doesn't recognize the key code that Macs send for backspace. I don't have a Mac for testing right now, but I added logging in the dev branch to show what key codes are pressed in the input queries. On Kubuntu in Konsole it gives |
Oh Curses. Last time I did something like this I did it with click and urwid after beating my head against curses for a day or two. Backspace is 127 (aka ^?) and delete is 330 (aka ^[[3~). Note that some users do send ^H for backspace on OS X (there's a checkbox in both Apple Terminal and iTerm2 to support this.) Just to make things even more fun, ^? is what is sent as delete on certain keyboard layouts. :) |
Yeah, curses isn't so much fun, but I just chose it since it's in the stdlib. Unfortunately the input stuff sucks and I've had to cover different key variants in the key bindings. I'll do the same for the Textbox object for now to fix this :). Later I should probably roll my own input prompt based on the Editor component. urwid seems worth checking out. I've mostly tried to seperate the UI from the logic. One day I just might implement an alternative UI with urwid. |
Hi! I finally got to this and pushed a new version to master. Hope it works smoothly, let me know :) |
Sorry to bother you again, but any word on this? Let me know if backspace is working properly 👍 |
Could you @abl or somebody try and check this out on a Mac? I'll try and get my hands on one eventually, but that might take a while. I hope this works now. |
Update: I'll have to do some refactoring and cleaning on them first, but after this gets done, the prompts will behave identically with the editor, which is ideal. It's a high priority issue. |
I can confirm the current version works with backspace. However, delete (Fn+backspace) does not. There is also no visible cursor in prompts, even though it works as expected. Python 3.5 on OS X 10.11 El Capitan, using the default Terminal App with a Gnome terminal like color theme. (It is possible to delete the characters "Save as:" as well by using backspace. Though I assume that is not OS X specific) |
Hi, thanks for reporting! 👍 I'll have to implement a custom input prompt when I have time, so that it'll behave just like the editor itself. Unfortunately that change requires some refactoring, so it might take a while to get ready. Just to recap the problems here's a list (for myself):
|
I'm closing this since the original issue is fixed. I've made great progres on the other three related problems (and #95). Hopefully I'll get these to master asap! |
I'll try to dig deeper but figured I'd post this in case it's obvious.
Normal editing works great; prompts (e.g. Save As / Exit Without Saving) do not support backspace.
Python version 3.4.3; built with Homebrew; 5913e4e
To reproduce, just open a file, press F1 to Save As, and attempt to backspace; nothing happens - not even a bell.
Reproduced on iTerm2 and on Apple Terminal.
The text was updated successfully, but these errors were encountered: