summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-02-27 20:29:53 +0000
committerMaxime Coste <mawww@kakoune.org>2017-02-27 20:29:53 +0000
commite5e705e151e589f13c905a54339c7245c300379e (patch)
treea0b49f00f2cbcb834ce63d5ac40a6018b95a1641
parent72bea292f8ff25436fd288d8ca86176cc6eb7505 (diff)
Fix clang warnings about uninitialized timestamp field
Closes #1241
-rw-r--r--src/insert_completer.cc8
-rw-r--r--src/insert_completer.hh10
2 files changed, 13 insertions, 5 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc
index f11c0bf7..1bc30ea4 100644
--- a/src/insert_completer.cc
+++ b/src/insert_completer.cc
@@ -181,7 +181,7 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o
candidates.push_back({m.candidate().str(), "", std::move(menu_entry)});
}
- return { word_begin, cursor_pos, std::move(candidates), buffer.timestamp() };
+ return { std::move(candidates), word_begin, cursor_pos, buffer.timestamp() };
}
template<bool require_slash>
@@ -235,7 +235,7 @@ InsertCompletion complete_filename(const SelectionList& sels,
}
if (candidates.empty())
return {};
- return { begin.coord(), pos.coord(), std::move(candidates), buffer.timestamp() };
+ return { std::move(candidates), begin.coord(), pos.coord(), buffer.timestamp() };
}
InsertCompletion complete_option(const SelectionList& sels,
@@ -309,7 +309,7 @@ InsertCompletion complete_option(const SelectionList& sels,
candidates.push_back({ match.candidate().str(), match.docstring.str(),
std::move(match.menu_entry) });
- return { coord, end, std::move(candidates), timestamp };
+ return { std::move(candidates), coord, end, timestamp };
}
}
return {};
@@ -341,7 +341,7 @@ InsertCompletion complete_line(const SelectionList& sels, const OptionManager& o
return {};
std::sort(candidates.begin(), candidates.end());
candidates.erase(std::unique(candidates.begin(), candidates.end()), candidates.end());
- return { cursor_pos.line, cursor_pos, std::move(candidates), buffer.timestamp() };
+ return { std::move(candidates), cursor_pos.line, cursor_pos, buffer.timestamp() };
}
}
diff --git a/src/insert_completer.hh b/src/insert_completer.hh
index bb3a6caf..dac3db27 100644
--- a/src/insert_completer.hh
+++ b/src/insert_completer.hh
@@ -64,11 +64,19 @@ struct InsertCompletion
using CandidateList = Vector<Candidate, MemoryDomain::Completion>;
+ CandidateList candidates;
BufferCoord begin;
BufferCoord end;
- CandidateList candidates;
size_t timestamp;
+ InsertCompletion() : timestamp{0} {}
+
+ InsertCompletion(CandidateList candidates,
+ BufferCoord begin, BufferCoord end,
+ size_t timestamp)
+ : candidates{std::move(candidates)}, begin{begin}, end{end},
+ timestamp{timestamp} {}
+
bool is_valid() const { return not candidates.empty(); }
};