From 1684eced8aca268b170c157143aa45a396057bd4 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 17 Jun 2014 12:34:57 -0400 Subject: [PATCH] Remove (broken) command history This reverts commit cc07a373f3b48918060da2800e83d4f37eeb34a5. --- plugins/command-prompt.cpp | 42 ++++---------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 345eee603..5815af59b 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include "df/interface_key.h" #include "df/ui.h" @@ -26,8 +25,6 @@ using df::global::ui; using df::global::gps; using df::global::enabler; -std::vector command_history; - class viewscreen_commandpromptst; class prompt_ostream:public buffered_color_ostream { @@ -48,17 +45,15 @@ public: void render(); void help() { } + int8_t movies_okay() { return 0; } std::string getFocusString() { return "commandprompt"; } - int8_t movies_okay() { return 0; } viewscreen_commandpromptst(std::string entry):is_response(false),entry(entry) { show_fps=df::global::gps->display_frames; df::global::gps->display_frames=0; cursor_pos = 0; frame = 0; - history_idx = command_history.size(); - command_history.push_back(""); } ~viewscreen_commandpromptst() { @@ -77,7 +72,6 @@ public: protected: std::list > responses; int cursor_pos; - int history_idx; bool is_response; bool show_fps; int frame; @@ -148,8 +142,6 @@ void viewscreen_commandpromptst::submit() //color_ostream_proxy out(Core::getInstance().getConsole()); prompt_ostream out(this); Core::getInstance().runCommand(out, entry); - command_history.pop_back(); - command_history.push_back(entry); if(out.empty() && responses.empty()) Screen::dismiss(this); else @@ -173,12 +165,12 @@ void viewscreen_commandpromptst::feed(std::set *events) } return; } - if(events->count(interface_key::SELECT)) + if (events->count(interface_key::SELECT)) { submit(); return; } - if(is_response) + if (is_response) return; for (auto it = events->begin(); it != events->end(); ++it) { @@ -212,8 +204,7 @@ void viewscreen_commandpromptst::feed(std::set *events) else if(events->count(interface_key::CURSOR_LEFT)) { cursor_pos--; - if (cursor_pos < 0) - cursor_pos = 0; + if (cursor_pos < 0) cursor_pos = 0; } else if(events->count(interface_key::CUSTOM_CTRL_A)) { @@ -223,30 +214,6 @@ void viewscreen_commandpromptst::feed(std::set *events) { cursor_pos = entry.size(); } - else if(events->count(interface_key::CURSOR_UP)) - { - if (command_history.back() == "") - { - command_history.pop_back(); - command_history.push_back(entry); - } - history_idx--; - if (history_idx < 0) - history_idx = 0; - entry = command_history[history_idx]; - cursor_pos = entry.size(); - } - else if(events->count(interface_key::CURSOR_DOWN)) - { - if (history_idx < command_history.size() - 1) - { - history_idx++; - if (history_idx >= command_history.size()) - history_idx = command_history.size() - 1; - entry = command_history[history_idx]; - cursor_pos = entry.size(); - } - } if (old_pos != cursor_pos) frame = 0; } @@ -273,7 +240,6 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector