[Lldb-commits] [lldb] r334978 - Fixed file completion for paths that start with '~'.

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 19 08:04:11 PDT 2018


A test?

It looks like it should be possible to test this in a similar way to
other CommandCompletion tests
(unittests/Interpreter/TestCompletion.cpp).
On Mon, 18 Jun 2018 at 21:16, Raphael Isemann via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
>
> Author: teemperor
> Date: Mon Jun 18 13:11:38 2018
> New Revision: 334978
>
> URL: http://llvm.org/viewvc/llvm-project?rev=334978&view=rev
> Log:
> Fixed file completion for paths that start with '~'.
>
> We didn't add the remaining path behind the '~' to the completion string,
> causing it to just complete directories inside the user home directory. This
> patch just adds the directory of the remaining path if there is one.
>
> Fixes rdar://problem/40147002
>
> Modified:
>     lldb/trunk/source/Commands/CommandCompletions.cpp
>
> Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=334978&r1=334977&r2=334978&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
> +++ lldb/trunk/source/Commands/CommandCompletions.cpp Mon Jun 18 13:11:38 2018
> @@ -164,6 +164,12 @@ static int DiskFilesOrDirectories(const
>      // search in the fully resolved directory, but CompletionBuffer keeps the
>      // unmodified form that the user typed.
>      Storage = Resolved;
> +    llvm::StringRef RemainderDir = path::parent_path(Remainder.str());
> +    if (!RemainderDir.empty()) {
> +      // Append the remaining path to the resolved directory.
> +      Storage.append(path::get_separator());
> +      Storage.append(RemainderDir);
> +    }
>      SearchDir = Storage;
>    } else {
>      SearchDir = path::parent_path(CompletionBuffer);
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list