[Lldb-commits] [PATCH] D152013: [lldb/Commands] Fix disk completion from root directory
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 2 10:41:15 PDT 2023
mib created this revision.
mib added reviewers: JDevlieghere, bulbazord, kastiglione.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.
This patch should fix path completion starting from the root directory.
To do so, this patch adds a special case when setting the search
directory when the completion buffer points to the root directory.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152013
Files:
lldb/source/Commands/CommandCompletions.cpp
Index: lldb/source/Commands/CommandCompletions.cpp
===================================================================
--- lldb/source/Commands/CommandCompletions.cpp
+++ lldb/source/Commands/CommandCompletions.cpp
@@ -381,6 +381,8 @@
Storage.append(RemainderDir);
}
SearchDir = Storage;
+ } else if (CompletionBuffer == path::root_directory(CompletionBuffer)) {
+ SearchDir = CompletionBuffer;
} else {
SearchDir = path::parent_path(CompletionBuffer);
}
@@ -390,9 +392,11 @@
PartialItem = path::filename(CompletionBuffer);
// path::filename() will return "." when the passed path ends with a
- // directory separator. We have to filter those out, but only when the
- // "." doesn't come from the completion request itself.
- if (PartialItem == "." && path::is_separator(CompletionBuffer.back()))
+ // directory separator or the separator when passed the disk root directory.
+ // We have to filter those out, but only when the "." doesn't come from the
+ // completion request itself.
+ if ((PartialItem == "." || PartialItem == path::get_separator()) &&
+ path::is_separator(CompletionBuffer.back()))
PartialItem = llvm::StringRef();
if (SearchDir.empty()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152013.527907.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230602/58559314/attachment.bin>
More information about the lldb-commits
mailing list