From d0b634216cbf499d0dda14dccd7893e62816693e Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Sat, 6 Nov 2021 23:32:12 +0100 Subject: [PATCH] Don't set cursor on empty text --- src/game/client/ui_ex.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/client/ui_ex.cpp b/src/game/client/ui_ex.cpp index b1067d298..377444fc6 100644 --- a/src/game/client/ui_ex.cpp +++ b/src/game/client/ui_ex.cpp @@ -312,9 +312,11 @@ int CUIEx::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrSi UpdateOffset = true; } + bool IsEmptyText = false; if(pDisplayStr[0] == '\0') { pDisplayStr = pEmptyText; + IsEmptyText = true; TextRender()->TextColor(1, 1, 1, 0.75f); } @@ -382,7 +384,7 @@ int CUIEx::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrSi m_MouseCurX = UI()->MouseX(); m_MouseCurY = UI()->MouseY(); } - HasMouseSel = m_MouseIsPress; + HasMouseSel = m_MouseIsPress && !IsEmptyText; if(m_MouseIsPress && UI()->MouseButtonReleased(0)) { m_MouseIsPress = false;