X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Frenderers%2Fwidget%2Ftextinput.c;fp=Usermode%2FApplications%2Faxwin3_src%2FWM%2Frenderers%2Fwidget%2Ftextinput.c;h=9a0ae64191364450d66f07b26de05e12628eda3b;hb=8c12dd82f2a4e01d8de5d29db6d4fdd0802c7e83;hp=2e21e7890362058cdb03f86d1aeb94173440ff50;hpb=3ae2c079ea44ea7a8fb1a65e7b9ff5d76f3f4c24;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c b/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c index 2e21e789..9a0ae641 100644 --- a/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c +++ b/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c @@ -13,6 +13,10 @@ #include #include +// TODO: Include a proper keysym header +#define KEYSYM_LEFTARROW 0x50 +#define KEYSYM_RIGHTARROW 0x4F + struct sTextInputInfo { int DrawOfs; // Byte offset for the leftmost character @@ -128,7 +132,26 @@ int Widget_TextInput_KeyFire(tElement *Element, int KeySym, int Character) // _SysDebug("Key 0x%x fired ('%c')", Character, Character); if( Character == 0 ) + { + switch(KeySym) + { + case KEYSYM_LEFTARROW: + if( info->CursorByteOfs > 0 ) + { + len = ReadUTF8Rev(Element->Text, info->CursorByteOfs, &cp); + info->CursorByteOfs -= len; + } + break; + case KEYSYM_RIGHTARROW: + if( info->CursorByteOfs < info->Length ) + { + len = ReadUTF8(Element->Text + info->CursorByteOfs, &cp); + info->CursorByteOfs += len; + } + break; + } return 0; + } // TODO: Don't hard code if(Character > 0x30000000) return 0;