On Sat Apr 26 15:12:31 2025 +0000, eric pouech wrote:
> that's not sufficient, you have also to compare that inputbuffer up to
> current pos hasn't changed since previous call
> (eg directory with za, za2 and zb zb2 files... circle twice from "za",
> replace "za" by "zb" and circle with tab...)
I missed that case. I tested C:\win<tab> and C:\pro<tab> but resulting paths are different lengths.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_101953
On Sat Apr 26 15:12:31 2025 +0000, eric pouech wrote:
> looks to be that curPos can be \> \*numRead, hence reading garbage in
> that case
Line 312 terminates the buffer at *numRead, line 314 sets len to *numRead, and loop at 320 stops when !(curPos < len). Worst case is if curPos == len then we are checking the null terminator.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_101952
On Sat Apr 26 17:10:07 2025 +0000, Joe Souza wrote:
> Paths need to be quoted if they are long file names or they contain
> spaces, hence the check for findData.cAlternateFileName.
To do what you're asking here we would need to track whether each level in the path requires quotes, not just the current filename.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_101950
On Sat Apr 26 15:12:32 2025 +0000, eric pouech wrote:
> I think quote handling is not done as it should
> from what I see on native: quotes are added when generated word does
> contain characters that would need to be escaped (eg ' ', but didn't
> check all the others)
> need quote is an attribute of current filename (ie they are removed when
> the new (partial) matching file no longer needs them) ; so quotes
> shouldn't be part of the SEARCH_CONTEXT, but only used for display
> (basically: go to beg of word; if needs quotes, print quote; print
> (partial) word; print ending quotes (if needed)
Paths need to be quoted if they are long file names or they contain spaces, hence the check for findData.cAlternateFileName.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_101949
didn't play a lot with resulting code, mostly reviewed it
note: dir "c:\\Programs Files\\"\<tab\> should circle among the subdirectories... current code doesn't
also dir c\<tab\> (with a first file displayed), then reduce size of console window to be shorter than input line, will display input on line after the prompt
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_101938
eric pouech (@epo) commented about programs/cmd/lineedit.c:
> + }
> + lstrcatW(searchstr, L"*");
> + TRACE("New search: [%s]\n", wine_dbgstr_w(searchstr));
> +
> + sc.isDirSearch = IsDirectoryOperation(inputBuffer, inputBufferLength);
> + }
> +
> + FindNextMatchingDirectoryEntry(searchstr, &sc);
> +
> + if (sc.haveSearchResult) {
> + /* If this is our first time through here for this search, we need to find the insert position
> + * for the results. Note that this is very likely not the same location as the search position.
> + */
> + if (!sc.insertPos) {
> + /* If user entered a backslash after quotes, remove the quotes. */
> + if (curPos > 2 && inputBuffer[curPos-2] == L'\"' && inputBuffer[curPos-1] == L'\\') {
I think quote handling is not done as it should
from what I see on native: quotes are added when generated word does contain characters that would need to be escaped (eg ' ', but didn't check all the others)
need quote is an attribute of current filename (ie they are removed when the new (partial) matching file no longer needs them) ; so quotes shouldn't be part of the SEARCH_CONTEXT, but only used for display (basically: go to beg of word; if needs quotes, print quote; print (partial) word; print ending quotes (if needed)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7843#note_101937