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

OS X input handling in prompts doesn't support backspace #61

Closed
abl opened this issue Jun 9, 2015 · 10 comments
Closed

OS X input handling in prompts doesn't support backspace #61

abl opened this issue Jun 9, 2015 · 10 comments

Comments

@abl
Copy link
Contributor

abl commented Jun 9, 2015

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.

@richrd richrd self-assigned this Jun 10, 2015
@richrd
Copy link
Owner

richrd commented Jun 10, 2015

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 Query key input:263 for each backspace. Could you see what code you get for backspace?

@richrd richrd added the bug label Jun 10, 2015
@richrd richrd added this to the Version 1.0.0 milestone Jun 10, 2015
@abl
Copy link
Contributor Author

abl commented Jun 10, 2015

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. :)

@richrd
Copy link
Owner

richrd commented Jun 10, 2015

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.

@richrd
Copy link
Owner

richrd commented Jul 22, 2015

Hi! I finally got to this and pushed a new version to master.
I did some major refactoring and improvements, and tried to fix backspace on Mac too.

Hope it works smoothly, let me know :)

@richrd
Copy link
Owner

richrd commented Sep 6, 2015

Sorry to bother you again, but any word on this? Let me know if backspace is working properly 👍

@richrd
Copy link
Owner

richrd commented Sep 28, 2015

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.

@richrd
Copy link
Owner

richrd commented Oct 7, 2015

Update:
I've decided that I'll roll my own input prompt based on Viewer and Editor classes. (That would also resolve #95)

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.

@runfalk
Copy link

runfalk commented Jan 11, 2016

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)

@richrd
Copy link
Owner

richrd commented Jan 13, 2016

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):

  • Unreliable key bindings (and different from the editor)
  • Prompt text can be deleted
  • No visible cursor (and no multiple cursors)

@richrd
Copy link
Owner

richrd commented Feb 28, 2016

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!

@richrd richrd closed this as completed Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants