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

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 18 13:11:38 PDT 2018


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);




More information about the lldb-commits mailing list