On Thu Apr 17 17:44:58 2025 +0000, eric pouech wrote:
the logic of using CONSOLE_READCONSOLE_CONTROL is that it either returns when:
- ENTER is hit (as it would do if that parameter was NULL)
- or with a status saying that tab has been entered; at that point it's
up to caller to update the input buffer and call again ReadInput for the user to continue editing the line if you're interested I shall have somewhere an early implementation of this that I wrote when implementing the console counterpart (likely it no longer applies cleanly in cmd, but the logic should still be relevant
- don't remember why I didn't send it, or maybe it didn't fully work on
unix console) regarding the other MR, since ctrl-c handling in CONSOLE_READCONSOLE_CONTROL will require updating the console layer, I'd suggest not to wait on it, but you could integrate the remarks I made on how to call ReadInpuyt with CONSOLE_READCONSOLE_CONSOLE so the two MR would benefit from it
Regarding the second point, this code already does what you seem to
claim it does not. It supports tab-completion at any point in the command line. For example, if the user enters 'not' at C:\windows and then pressed the tab key, it is tab-completed to 'notepad.exe'. It also cycles through files and directories if the tab key is pressed at an empty command line. actually I was reacting the code in `IsDirectoryOperation()` which doesn't seem to exist in native
Thank you. Regarding IsDirectoryOperation, this is not an external API but rather an internal function. Windows definitely cycles through directories only, and not files, if the command being entered on the line is a directory operation like CD or MD, etc. For all other cases, and even for the command itself and at an empty command prompt, etc., the code will cycle through files and directories.
Regarding calling ReadConsole/CONSOLE_READCONSOLE_CONTROL, updating the buffer and then calling ReadConsoleInput, it seems we then still need the line editor code. It seems that the only benefit to that method would be mainly in the case where the user never uses the tab key. Otherwise I think that most of my code here would still remain.