try to fix lua console behavior wrt spacing, command history
This commit is contained in:
parent
7fafcd8086
commit
51baab8836
3 changed files with 9 additions and 2 deletions
|
@ -58,7 +58,7 @@
|
|||
# dialog-spanning scrollbars to appear on 800x480.
|
||||
#
|
||||
|
||||
{GUI_FORCE_WIDGET_MINIMUM_SIZE 600 400 (
|
||||
{GUI_FORCE_WIDGET_MINIMUM_SIZE 800 400 (
|
||||
[scroll_label]
|
||||
id = "msg"
|
||||
definition = "description"
|
||||
|
@ -80,6 +80,7 @@
|
|||
definition = "default"
|
||||
history = "lua_text_entry"
|
||||
label = ""
|
||||
size_text = "very long text which might need to fit yes indeed this text is so very very very long"
|
||||
[/text_box]
|
||||
[/column]
|
||||
[/row]
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "gui/dialogs/lua_interpreter.hpp"
|
||||
|
||||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/dialogs/field.hpp"
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
|
@ -105,6 +106,7 @@ void tlua_interpreter::bind(twindow& window)
|
|||
msg_label->set_vertical_scrollbar_mode(tscrollbar_container::always_visible);
|
||||
msg_label->set_label("");
|
||||
|
||||
register_text("text_entry", false, text_entry_, true);
|
||||
text_entry = &find_widget<ttext_box>(&window, "text_entry", false);
|
||||
//text_entry->set_text_changed_callback(
|
||||
// boost::bind(&view::filter, this, boost::ref(window)));
|
||||
|
@ -223,7 +225,9 @@ void tlua_interpreter::input_keypress_callback(bool& handled,
|
|||
LOG_LUA << "keypress_callback\n";
|
||||
if(key == SDLK_RETURN || key == SDLK_KP_ENTER) {
|
||||
LOG_LUA << "executing...\n";
|
||||
model_->execute(text_entry->get_value());
|
||||
if (model_->execute(text_entry->get_value())) {
|
||||
text_entry->save_to_history();
|
||||
}
|
||||
update_contents();
|
||||
text_entry->set_value("");
|
||||
handled = true;
|
||||
|
|
|
@ -63,6 +63,8 @@ private:
|
|||
tscroll_label* msg_label;
|
||||
tbutton* copy_button;
|
||||
ttext_box* text_entry;
|
||||
|
||||
std::string text_entry_;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue