| Index: src/d8-readline.cc
|
| diff --git a/src/d8-readline.cc b/src/d8-readline.cc
|
| index 8422783407f94fb56933da0794081f20bcdbe251..8bcaf5f4e1416b4d7ba00e25eeba9921c709e0d7 100644
|
| --- a/src/d8-readline.cc
|
| +++ b/src/d8-readline.cc
|
| @@ -72,6 +72,7 @@ bool ReadLineEditor::Open() {
|
| rl_completer_word_break_characters = kWordBreakCharacters;
|
| rl_bind_key('\t', rl_complete);
|
| using_history();
|
| + stifle_history(Shell::kMaxHistoryEntries);
|
| return read_history(Shell::kHistoryFileName) == 0;
|
| }
|
|
|
| @@ -88,6 +89,18 @@ i::SmartArrayPointer<char> ReadLineEditor::Prompt(const char* prompt) {
|
|
|
|
|
| void ReadLineEditor::AddHistory(const char* str) {
|
| + // Do not record empty input.
|
| + if (strlen(str) == 0) return;
|
| + // Remove duplicate history entry.
|
| + history_set_pos(0);
|
| + if (current_history()) {
|
| + do {
|
| + if (strcmp(current_history()->line, str) == 0) {
|
| + remove_history(where_history());
|
| + break;
|
| + }
|
| + } while (next_history());
|
| + }
|
| add_history(str);
|
| }
|
|
|
|
|