From 8eedabba7bd1298dce260ae1ddd5ebe48691a86b Mon Sep 17 00:00:00 2001 From: g0dil <g0dil@wiback.org> Date: Thu, 8 Jan 2009 22:02:37 +0000 Subject: [PATCH] Utils/Termlib: Implement aux display hide/show support --- Utils/Termlib/Editor.cc | 10 ++++++++++ Utils/Termlib/Editor.hh | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Utils/Termlib/Editor.cc b/Utils/Termlib/Editor.cc index f268efbe7..e8291a2e9 100644 --- a/Utils/Termlib/Editor.cc +++ b/Utils/Termlib/Editor.cc @@ -324,6 +324,11 @@ prefix_ void senf::term::LineEditor::show() if (enabled_) return; enabled_ = true; + for (unsigned n (0); n < auxDisplay_.size(); ++n) { + toLine(n+1); + put(auxDisplay_[n]); + } + toLine(0); forceRedisplay(); } @@ -331,6 +336,7 @@ prefix_ void senf::term::LineEditor::hide() { if (! enabled_) return; + reset(); clearLine(); enabled_ = false; } @@ -464,6 +470,9 @@ prefix_ void senf::term::LineEditor::auxDisplay(int line, std::string const & te toLine(line+1); clearLine(); put(text); + while (auxDisplay_.size() < line+1) + auxDisplay_.push_back(""); + auxDisplay_[line] = text; } prefix_ unsigned senf::term::LineEditor::maxAuxDisplayHeight() @@ -474,6 +483,7 @@ prefix_ unsigned senf::term::LineEditor::maxAuxDisplayHeight() prefix_ void senf::term::LineEditor::clearAuxDisplay() { reset(); + auxDisplay_.clear(); } prefix_ std::string const & senf::term::LineEditor::text() diff --git a/Utils/Termlib/Editor.hh b/Utils/Termlib/Editor.hh index d2d091c8b..e173a2944 100644 --- a/Utils/Termlib/Editor.hh +++ b/Utils/Termlib/Editor.hh @@ -159,6 +159,7 @@ namespace term { typedef std::map<keycode_t, KeyBinding> KeyMap; typedef std::vector<std::string> History; + typedef std::vector<std::string> AuxDisplay; bool enabled_; bool redisplayNeeded_; @@ -173,6 +174,7 @@ namespace term { KeyMap bindings_; History history_; unsigned historyPoint_; + AuxDisplay auxDisplay_; }; namespace bindings { -- GitLab