Unix / Linux support auto-complete of files and directories when pressing “tab”.
I need to create this ability in my windows application. I have a text field for user input of file name, which I want to respond to a “tab” press like it will do when we’re in a unix console:
- If there is one option – Auto-complete.
- Some options – show a list of the options.
- No options – nada.
For my SSH connection to my unix machine I use the ch.ethz.ssh API.
Is there a way to do so?
First you want to have a text field without focus cycling, and tab suppression:
Then a data model for the files (here local directory, but SSH is likewise):
Then a key pressed handling for the TAB:
Look for the longest common prefix in the file names. Display that.
What is missing is the display of the ambiguous file names. Popup menu would be nice, wouldn’t it?
Popup: