diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-07-24 09:12:27 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-07-24 09:12:27 +0200 |
commit | 962a8482da0eaaf4c50fd558c44b504705a7845b (patch) | |
tree | 03a803ced903538cf3c347737971897392066a87 | |
parent | 316b2a40f0bd9ccdf8a2ff2f2e097011cbb5fedf (diff) |
Adding history support to Readline.
-rw-r--r-- | includes/BReadline.h | 1 | ||||
-rw-r--r-- | src/Readline.cc | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/includes/BReadline.h b/includes/BReadline.h index 73756c4..0d39f8b 100644 --- a/includes/BReadline.h +++ b/includes/BReadline.h @@ -13,6 +13,7 @@ class Readline { void setPrompt(const Balau::String & prompt); private: EditLine * m_el = NULL; + History * m_hist = NULL; Balau::IO<Balau::Handle> m_in; bool m_eof = false; Balau::String m_prompt = "> "; diff --git a/src/Readline.cc b/src/Readline.cc index a58719d..ad324ee 100644 --- a/src/Readline.cc +++ b/src/Readline.cc @@ -6,15 +6,18 @@ using namespace Balau; Readline::Readline(const String & program, IO<Handle> in) : m_in(in) { + m_hist = history_init(); m_el = el_init(program.to_charp(), stdin, stdout, stderr); el_set(m_el, EL_CLIENTDATA, this); el_set(m_el, EL_PROMPT, (const char * (*)(EditLine *)) &Readline::elPrompt); el_set(m_el, EL_SIGNAL, 1); el_set(m_el, EL_GETCFN, (int (*)(EditLine *, char *)) &Readline::elGetCFN); + el_set(m_el, EL_HIST, history, m_hist); } Readline::~Readline() { el_end(m_el); + history_end(m_hist); } void Readline::setPrompt(const String & prompt) { |