From aafcd6c43aff79e5939960f7f0d8a0ca47b7796b Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 9 Jun 2014 17:00:26 -0400 Subject: [PATCH] Fix 4/6 behavior --- plugins/command-prompt.cpp | 41 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 140cc6f4d..c4bbd615d 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -189,28 +189,27 @@ void viewscreen_commandpromptst::feed(std::set *events) { entry.insert(cursor_pos, 1, char(key - interface_key::STRING_A000)); cursor_pos++; + return; } - // Prevent number keys from moving cursor - else if(events->count(interface_key::CURSOR_RIGHT)) - { - cursor_pos++; - if (cursor_pos > entry.size()) cursor_pos = entry.size(); - break; - } - else if(events->count(interface_key::CURSOR_LEFT)) - { - cursor_pos--; - if (cursor_pos < 0) cursor_pos = 0; - break; - } - else if(events->count(interface_key::CUSTOM_CTRL_A)) - { - cursor_pos = 0; - } - else if(events->count(interface_key::CUSTOM_CTRL_E)) - { - cursor_pos = entry.size(); - } + } + // Prevent number keys from moving cursor + if(events->count(interface_key::CURSOR_RIGHT)) + { + cursor_pos++; + if (cursor_pos > entry.size()) cursor_pos = entry.size(); + } + else if(events->count(interface_key::CURSOR_LEFT)) + { + cursor_pos--; + if (cursor_pos < 0) cursor_pos = 0; + } + else if(events->count(interface_key::CUSTOM_CTRL_A)) + { + cursor_pos = 0; + } + else if(events->count(interface_key::CUSTOM_CTRL_E)) + { + cursor_pos = entry.size(); } } DFHACK_PLUGIN("command-prompt");