Open fullfox opened 6 months ago
Thank you very much for this. This feature has been on the ToDo list for quite some time.
However in the current example there is not way to correct or go back on the typed stuff. I think it would make sens if BACKSAPCE would work or something similar, in case someone makes a type.
Also documentation would be nice, even if its not beeing deployed at the moment
also some pre-commit stuff fails
Hello,
Actually I've implemented the backspace deletion. Did you test and didn't it work ?
I'll check why nox fails tomorrow.
Yes I tested the provided example on windows and it didn't seem to work.
The its the flake8
pre-commit hook that fails. It just wants some formating corrections
Okay I fixed the backspace handling for windows, and i made it flake8 compliant.
Hello, could you check my pr ?
Sorry for the delay but I am on holiday until 24. Of February.
But its on the todo list for when I am back
also sidenote for the future: Rebasing onto the new state of main doesn't produce a bunch of merge-commits
Sure that would cover more use cases. I'll try to implement that this week.
Okay i changed the matcher
signature to matcher(choices: list, pressedKey: str, searchString: str) -> (int, str)
where searchString acts like a memory to handle scenario where we want to keep track of previous keys (a search for example). And the function returns a tuple (index, searchString) with the choosed index and the new searchString.
Hello,
This adds two features to the List():
matcher
function, the user can now select an entry by typing it, without keyboard arrows. Thematcher
function takes a "choice" and the "user query", and returns a boolean. On every keystroke (if the associated key is a letter), the first "choice" for which thematcher
function returned True will become the current selected one. If nothing matches, the current item remains the same.search=True
(False by default), if amatcher
function is defined, then the user search will be visible (using the already existing and unusedget_current_value
method)If the
choices
array contains tuples, it is the responsability of the user to provide amatcher
function that handles tuple instead on string.I've provided unit test and example in the commit. Hope this is clean enough. Please let me know if anything is unclear or if my implementation can be improved. If no
matcher
function is provided, the code behave exactly as before my commit.