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:
case HistoryOperation::Newer:
return H_PREV;
case HistoryOperation::Newest:
- return H_LAST;
+ return H_FIRST;
}
llvm_unreachable("Fully covered switch!");
}