summaryrefslogtreecommitdiff
path: root/src/gui/intlGUIEditBox.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2018-03-10 00:24:57 +0100
committerAndrew Ward <rw@rubenwardy.com>2018-03-09 23:24:57 +0000
commit473d81f2e2ad4b8077c9cfe241032c67d6a795c3 (patch)
treef1af794b18bb65d3a2327e2f7dc4a25d65a5a749 /src/gui/intlGUIEditBox.cpp
parent12d1e4ff0486f86ae20051daa1135dc7db366023 (diff)
downloadminetest-473d81f2e2ad4b8077c9cfe241032c67d6a795c3.tar.gz
minetest-473d81f2e2ad4b8077c9cfe241032c67d6a795c3.tar.bz2
minetest-473d81f2e2ad4b8077c9cfe241032c67d6a795c3.zip
Formspecs: Unify textarea and field parsing functions, fix wrong fallback text
* textarea[], field[]: Unify function, fix wrong fallback text * Remove apparently superflous mainmenumanager.h incldue * intlGUIEditBox.cpp: make read-only boxes really read-only * Use elseif (trivial)
Diffstat (limited to 'src/gui/intlGUIEditBox.cpp')
-rw-r--r--src/gui/intlGUIEditBox.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/gui/intlGUIEditBox.cpp b/src/gui/intlGUIEditBox.cpp
index 8b0f10721..8c661b9f3 100644
--- a/src/gui/intlGUIEditBox.cpp
+++ b/src/gui/intlGUIEditBox.cpp
@@ -354,8 +354,7 @@ bool intlGUIEditBox::processKey(const SEvent& event)
break;
case KEY_KEY_X:
// cut to the clipboard
- if (!PasswordBox && Operator && MarkBegin != MarkEnd)
- {
+ if (!PasswordBox && Operator && MarkBegin != MarkEnd) {
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
@@ -364,8 +363,7 @@ bool intlGUIEditBox::processKey(const SEvent& event)
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(sc.c_str());
- if (IsEnabled)
- {
+ if (IsEnabled && m_writable) {
// delete
core::stringw s;
s = Text.subString(0, realmbgn);
@@ -380,7 +378,7 @@ bool intlGUIEditBox::processKey(const SEvent& event)
}
break;
case KEY_KEY_V:
- if ( !IsEnabled )
+ if (!IsEnabled || !m_writable)
break;
// paste from the clipboard
@@ -636,7 +634,7 @@ bool intlGUIEditBox::processKey(const SEvent& event)
break;
case KEY_BACK:
- if ( !this->IsEnabled )
+ if (!this->IsEnabled || !m_writable)
break;
if (!Text.empty()) {
@@ -675,7 +673,7 @@ bool intlGUIEditBox::processKey(const SEvent& event)
}
break;
case KEY_DELETE:
- if ( !this->IsEnabled )
+ if (!this->IsEnabled || !m_writable)
break;
if (!Text.empty()) {
@@ -1351,7 +1349,7 @@ s32 intlGUIEditBox::getLineFromPos(s32 pos)
void intlGUIEditBox::inputChar(wchar_t c)
{
- if (!IsEnabled)
+ if (!IsEnabled || !m_writable)
return;
if (c != 0)