mirror of
https://github.com/open-goal/jak-project
synced 2026-09-03 10:21:36 -04:00
repl: Support cross-session history (#301)
This commit is contained in:
@@ -10,9 +10,10 @@
|
||||
*/
|
||||
|
||||
#include "Reader.h"
|
||||
#include "third-party/linenoise.h"
|
||||
#include "common/util/FileUtil.h"
|
||||
#include "third-party/fmt/core.h"
|
||||
#include <filesystem>
|
||||
#include "ReplHistory.h"
|
||||
|
||||
namespace goos {
|
||||
|
||||
@@ -103,7 +104,7 @@ void TextStream::seek_past_whitespace_and_comments() {
|
||||
|
||||
Reader::Reader() {
|
||||
// third-party library used for a fancy line in
|
||||
linenoise::SetHistoryMaxLen(400);
|
||||
ReplHistory::repl_set_history_max_size(5000);
|
||||
|
||||
// add default macros
|
||||
add_reader_macro("'", "quote");
|
||||
@@ -142,8 +143,8 @@ Object Reader::read_from_stdin(const std::string& prompt_name) {
|
||||
std::string line;
|
||||
// escape code will make sure that we remove any color
|
||||
std::string prompt_full = "\033[0m" + prompt_name + "> ";
|
||||
linenoise::Readline(prompt_full.c_str(), line);
|
||||
linenoise::AddHistory(line.c_str());
|
||||
ReplHistory::repl_readline(prompt_full.c_str(), line);
|
||||
ReplHistory::repl_add_to_history(line.c_str());
|
||||
// todo, decide if we should keep reading or not.
|
||||
|
||||
// create text fragment and add to the DB
|
||||
|
||||
Reference in New Issue
Block a user