Merge pull request #841 from GregoryLundberg/GL_text_input

[text_input] Fix bug 25173
This commit is contained in:
Charles Dang 2016-10-25 15:12:38 +11:00 committed by GitHub
commit ee4d1f5a60
4 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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;
};
/**

View file

@ -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)) {