Skip to content

Commit

Permalink
Merge pull request #841 from GregoryLundberg/GL_text_input
Browse files Browse the repository at this point in the history
[text_input] Fix bug 25173
  • Loading branch information
Vultraz committed Oct 25, 2016
2 parents 13effa4 + 9d08723 commit ee4d1f5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/lua/wml/message.lua
Expand Up @@ -230,6 +230,7 @@ local function message_user_choice(cfg, speaker, options, text_input)
label = text_input.label or "",
text = text_input.text or "",
max_length = input_max_size,
text_input_was_specified = "yes",
}
end

Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/wml_message.cpp
Expand Up @@ -176,7 +176,7 @@ int show_wml_message(CVideo& video,
}
assert(dlg.get());

if(!input.caption.empty()) {
if(input.text_input_was_specified) {
dlg->set_input(input.caption, &input.text, input.maximum_length);
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/dialogs/wml_message.hpp
Expand Up @@ -218,6 +218,8 @@ struct twml_message_input
mutable std::string text;
/// The maximum length of the text.
unsigned maximum_length;
/// True when [text_input] appeared in [message]
bool text_input_was_specified;
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/scripting/lua_gui2.cpp
Expand Up @@ -280,6 +280,7 @@ int show_message_dialog(lua_State *L, CVideo & video)
input.caption = txt_cfg["label"].str();
input.text = txt_cfg["text"].str();
input.maximum_length = txt_cfg["max_length"].to_int(256);
input.text_input_was_specified = txt_cfg["text_input_was_specified"].to_bool(false);

gui2::twml_message_options options;
if (!lua_isnoneornil(L, 2)) {
Expand Down

0 comments on commit ee4d1f5

Please sign in to comment.