3955: Fix disallowing arrow keys in editor edit box r=Learath2 a=Jupeyy

So that you cannot use arrow keys in the edit box,
this was default behavior before(was accidentally removed by ui ex)
and for arrow up and down it wasn't implemented yet

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2021-07-17 16:58:20 +00:00 committed by GitHub
commit 2946632d7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -328,6 +328,8 @@ int CEditor::DoClearableEditBox(void *pID, void *pClearID, const CUIRect *pRect,
int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrSize, float FontSize, float *Offset, bool Hidden, int Corners)
{
if(UI()->LastActiveItem() == pID)
m_EditBoxActive = 2;
return m_UIEx.DoEditBox(pID, pRect, pStr, StrSize, FontSize, Offset, Hidden, Corners);
}
@ -3342,7 +3344,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
}
}
if(Input()->KeyPress(KEY_DOWN) && m_Dialog == DIALOG_NONE)
if(Input()->KeyPress(KEY_DOWN) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
{
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
{
@ -3373,7 +3375,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
}
}
}
if(Input()->KeyPress(KEY_UP) && m_Dialog == DIALOG_NONE)
if(Input()->KeyPress(KEY_UP) && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0)
{
if(Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT))
{