From 48cd8e2acdbfd364ef0c5f2ed6cbf6691d1e5b61 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 7 May 2024 16:42:37 +0200 Subject: [PATCH] history tweak --- console.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/console.cpp b/console.cpp index d446a59..be5ac2c 100644 --- a/console.cpp +++ b/console.cpp @@ -182,7 +182,7 @@ std::string console::read_line(const std::string & prompt) put_string(prompt); put_string(">"); - if (edit_lines_hist.empty() == false) + while(edit_lines_hist.size() >= n_edit_lines_hist) edit_lines_hist.erase(edit_lines_hist.begin()); while(edit_lines_hist.size() < n_edit_lines_hist) @@ -267,6 +267,9 @@ std::string console::read_line(const std::string & prompt) put_string_lf(""); + if (line_nr != edit_lines_hist.size() - 1) + edit_lines_hist.push_back(edit_lines_hist.at(line_nr)); + return edit_lines_hist.at(line_nr); }