aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2021-05-21 17:26:02 +0200
committersfan5 <sfan5@live.de>2021-05-22 14:39:41 +0200
commit93f43c890bf53dcdfccdd87601bea60e43862861 (patch)
tree58a13869f361b895d26b074f8e55ff7a1ea452c6
parent4152227f17315a9cf9038266d9f9bb06e21e3424 (diff)
downloadminetest-93f43c890bf53dcdfccdd87601bea60e43862861.tar.gz
minetest-93f43c890bf53dcdfccdd87601bea60e43862861.tar.bz2
minetest-93f43c890bf53dcdfccdd87601bea60e43862861.zip
GUIEditBox: Allow selecting and copying read-only texts
-rw-r--r--src/gui/guiEditBox.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/gui/guiEditBox.cpp b/src/gui/guiEditBox.cpp
index ba548aa2d..43afb6e3e 100644
--- a/src/gui/guiEditBox.cpp
+++ b/src/gui/guiEditBox.cpp
@@ -232,10 +232,6 @@ bool GUIEditBox::OnEvent(const SEvent &event)
bool GUIEditBox::processKey(const SEvent &event)
{
- if (!m_writable) {
- return false;
- }
-
if (!event.KeyInput.PressedDown)
return false;
@@ -531,6 +527,9 @@ bool GUIEditBox::onKeyControlX(const SEvent &event, s32 &mark_begin, s32 &mark_e
// First copy to clipboard
onKeyControlC(event);
+ if (!m_writable)
+ return false;
+
if (m_passwordbox || !m_operator || m_mark_begin == m_mark_end)
return false;
@@ -556,7 +555,7 @@ bool GUIEditBox::onKeyControlX(const SEvent &event, s32 &mark_begin, s32 &mark_e
bool GUIEditBox::onKeyControlV(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
- if (!isEnabled())
+ if (!isEnabled() || !m_writable)
return false;
// paste from the clipboard
@@ -602,7 +601,7 @@ bool GUIEditBox::onKeyControlV(const SEvent &event, s32 &mark_begin, s32 &mark_e
bool GUIEditBox::onKeyBack(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
- if (!isEnabled() || Text.empty())
+ if (!isEnabled() || Text.empty() || !m_writable)
return false;
core::stringw s;
@@ -640,7 +639,7 @@ bool GUIEditBox::onKeyBack(const SEvent &event, s32 &mark_begin, s32 &mark_end)
bool GUIEditBox::onKeyDelete(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
- if (!isEnabled() || Text.empty())
+ if (!isEnabled() || Text.empty() || !m_writable)
return false;
core::stringw s;