diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 6d82a9826b393..f73255d322409 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -99,18 +99,24 @@ bool IsOnlySpaces(const EditLineStringType &content) { static int GetOperation(HistoryOperation op) { // The naming used by editline for the history operations is counter - // intuitive to how it's used here. + // intuitive to how it's used in LLDB's editline implementation. + // + // - The H_LAST returns the oldest entry in the history. // // - The H_PREV operation returns the previous element in the history, which // is newer than the current one. // + // - The H_CURR returns the current entry in the history. + // // - The H_NEXT operation returns the next element in the history, which is // older than the current one. // + // - The H_FIRST returns the most recent entry in the history. + // // The naming of the enum entries match the semantic meaning. switch(op) { case HistoryOperation::Oldest: - return H_FIRST; + return H_LAST; case HistoryOperation::Older: return H_NEXT; case HistoryOperation::Current: @@ -118,7 +124,7 @@ static int GetOperation(HistoryOperation op) { case HistoryOperation::Newer: return H_PREV; case HistoryOperation::Newest: - return H_LAST; + return H_FIRST; } llvm_unreachable("Fully covered switch!"); }