summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeComplete.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index b2f537c38d7..a3b4d3c117c 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -1391,12 +1391,12 @@ private:
unsigned RangeEnd = HeuristicPrefix.Qualifier.begin() - Content.data(),
RangeBegin = RangeEnd;
for (size_t I = 0; I < 3 && RangeBegin > 0; ++I) {
- auto PrevNL = Content.rfind('\n', RangeBegin - 1);
+ auto PrevNL = Content.rfind('\n', RangeBegin);
if (PrevNL == StringRef::npos) {
RangeBegin = 0;
break;
}
- RangeBegin = PrevNL + 1;
+ RangeBegin = PrevNL;
}
ContextWords = collectWords(Content.slice(RangeBegin, RangeEnd));
OpenPOWER on IntegriCloud