-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
[WIP] Advanced tab-completion for the console #1840
Conversation
Yes,
Would be good, pls look at https://github.com/nesbox/TIC-80/blob/main/src/studio/screens/console.c#L3913 where we sort commands for example.
It needs an investigation.
Don't know what to say, make your own decision :)
Seems you should use Thanks for the amazing work. |
28221ec
to
7359f83
Compare
Can we merge it before the release? |
Implementing sorted completions would likely need a few more hours of work – but I'm really happy with this PR as-is! We can always add sorting later! :) |
I'd appreciate code review/feedback/help on this! I'm building better tab-completion, which is aware of the different commands. It knows how to complete files, directories, help topics, commands, and the import/export types:
Implementation notes:
AutocompleteData
struct keeps track of the word the user is trying to tab-complete, the options that have been gathered so far, as a string, and the longest common prefix of all options, in order to add it to the typed command later.addAutocompleteOption
adds a possible completion option to the struct.finishAutocomplete
is called to actually perform the tab-completion, its shows all options and expands the typed command.Questions/things to do:
char*
of sizeCONSOLE_BUFFER_SIZE
. That seems excessive, but I'm not sure which other maximum size to pick?tic_fs_enum
usingMOVE
to pass the data object? I should probably do that, as well? But I don't understand why. -> it's an async functioncd tic80.com
andload w<tab>
, TIC-80 crashes inaddAutocompleteOption
. I guess this could be related. -> It was!