aboutsummaryrefslogtreecommitdiff
path: root/src/guiFormSpecMenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r--src/guiFormSpecMenu.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index dd96da5a9..2564671a3 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -894,8 +894,8 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
{
std::vector<std::string> parts = split(element,';');
- if ((parts.size() == 4) ||
- ((parts.size() > 4) && (m_formspec_version > FORMSPEC_API_VERSION)))
+ if ((parts.size() == 4) || (parts.size() == 5) ||
+ ((parts.size() > 5) && (m_formspec_version > FORMSPEC_API_VERSION)))
{
std::vector<std::string> v_pos = split(parts[0],',');
std::vector<std::string> v_geom = split(parts[1],',');
@@ -952,6 +952,11 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
evt.KeyInput.Shift = 0;
evt.KeyInput.PressedDown = true;
e->OnEvent(evt);
+
+ if (parts.size() >= 5 && !is_yes(parts[4])) {
+ spec.close_on_enter = false;
+ }
+
m_fields.push_back(spec);
return;
}
@@ -1033,6 +1038,10 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,
}
}
+ if (parts.size() >= 4 && !is_yes(parts[3])) {
+ spec.close_on_enter = false;
+ }
+
m_fields.push_back(spec);
}
@@ -1137,6 +1146,11 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,
addStaticText(Environment, spec.flabel.c_str(), rect, false, true, this, 0);
}
}
+
+ if (parts.size() >= 6 && !is_yes(parts[5])) {
+ spec.close_on_enter = false;
+ }
+
m_fields.push_back(spec);
}
@@ -1150,8 +1164,8 @@ void GUIFormSpecMenu::parseField(parserData* data,std::string element,
return;
}
- if ((parts.size() == 5) ||
- ((parts.size() > 5) && (m_formspec_version > FORMSPEC_API_VERSION)))
+ if ((parts.size() == 5) || (parts.size() == 6) ||
+ ((parts.size() > 6) && (m_formspec_version > FORMSPEC_API_VERSION)))
{
parseTextArea(data,parts,type);
return;
@@ -2698,6 +2712,7 @@ void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
if (!current_field_enter_pending.empty()) {
fields["key_enter_field"] = current_field_enter_pending;
+ current_field_enter_pending = "";
}
if (current_keys_pending.key_escape) {
@@ -3630,15 +3645,18 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
if (event.GUIEvent.EventType == gui::EGET_EDITBOX_ENTER) {
if (event.GUIEvent.Caller->getID() > 257) {
+ bool close_on_enter = true;
for (u32 i = 0; i < m_fields.size(); i++) {
FieldSpec &s = m_fields[i];
if (s.ftype == f_Unknown &&
s.fid == event.GUIEvent.Caller->getID()) {
current_field_enter_pending = s.fname;
+ close_on_enter = s.close_on_enter;
+ break;
}
}
- if (m_allowclose) {
+ if (m_allowclose && close_on_enter) {
current_keys_pending.key_enter = true;
acceptInput(quit_mode_accept);
quitMenu();