X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FTermlib%2FEditor.cc;h=8d16f4db9d923eecec3450ce1aee9253417a7e42;hb=a726ae0cb14d0ce37e5aab3c4e07121bbbd3b31c;hp=f268efbe7003bb04195edc3a2285d30a13b0d5fa;hpb=0461eef93912cb9d454d726b4a7b4ccf50ed31bd;p=senf.git diff --git a/Utils/Termlib/Editor.cc b/Utils/Termlib/Editor.cc index f268efb..8d16f4d 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() @@ -653,18 +663,9 @@ prefix_ void senf::term::bindings::complete(LineEditor & editor, Completer compl didComplete = true; } - // If completion is already unique, make sure completion is followed by a space and place cursor - // after that space - if (completions.size() == 1u) { - if (text.size() <= commonStart || text[commonStart] != ' ') - text.insert(commonStart, " "); - editor.set(text, commonStart + 1); - return; - } - - // Otherwise place cursor directly after the partial completion + // Otherwise place cursor directly after the (possibly partial) completion editor.set(text, commonStart); - if (didComplete) + if (didComplete || completions.size() == 1) return; // Text was not changed, show list of possible completions