Closed PabloLec closed 3 years ago
Sure! I didn't think about that.
Also, I made the name plural, KEYS_BACKSPACE
as I saw other plural occurences of the word "key". But maybe it will not be really clear for the users as to why use a plural name for a single key. Also it will break backward compatibility. I guess I should either just rename it or make an alias, keep the KEYS
to make it clear it's a list for maintainers but also refer it as KEY
for users. (?)
Ah good thing you mentioned that as I didn't even notice :sweat_smile:
I think keeping it at KEY_BACKSPACE
without the plural would be best - this way it's more transparent to the user, and won't break BC. Maybe something like _KEYS_BACKSPACE
as an internal alias would be a good idea as well so it makes sense internally, but for someone using the library, KEY
singular is more clear imo.
Also, this same add_key_command
logic needs to be implemented in the Widget
class, since the key commands can be applied to widgets as well
Yeah I'll just drop the "S". I'm not on my usual dev environment right now, I'll wait until tomorrow to make the changes (I don't want to miss any occurence). Just saying in case you want to implement this change in 0.1.4.
And will do for Widget
too 😉
I actually just released 0.1.4, so this will have to wait for the next one. Hope the next release won't take as long, since I have more less ambitious features I want to add, and some bug fixes - no huge logging overhauls or mouse support additions
Ok, I think this one is ready for merge.
This PR tries to solve #74. Currently the
KEY_BACKSPACE
var is set either explicitly if win32 or darwin, or else by curses. The thing is curses might get a wrong backspace key on Linux depending on$TERM
environment variable value and actual terminal conf.To solve this issue, we might just catch as a backspace all possible values. Either
8
(ASCII BS),127
(ASCII DEL) and any other value returned bycurses.KEY_BACKSPACE
.This shouldn't cause any false positive as
8
and127
are well defined, except if a user explicitly tweaked his terminal configuration for8
and127
which would cause trouble with curses anyway.What this pull request changes
KEY_BACKSPACE
is now a listKEYS_BACKSPACE
.Issues fixed with this pull request
74
Optionally, what changes should join this PR
If this solution is accepted, I will need to edit docs reference of
KEY_BACKSPACE
.