aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/gwin_textedit.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c
index 999a91dd..8f5cb8dd 100644
--- a/src/gwin/gwin_textedit.c
+++ b/src/gwin/gwin_textedit.c
@@ -86,7 +86,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char
// Parse the key press
else if (pke->bytecount >= 1) {
- // Check backspace
+ // Is it backspace?
if (pke->c[0] == GKEY_BACKSPACE) {
if (gw2obj->cursorPos == 0) {
return;
@@ -94,6 +94,15 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char
_shiftTextLeft(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos--);
}
+ // Is it delete?
+ else if (pke->c[0] == GKEY_DEL) {
+ // Check whether there is a character on the right side of the cursor
+ if (gw2obj->textBuffer[gw2obj->cursorPos] == '\0') {
+ return;
+ }
+ _shiftTextLeft(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos+1);
+ }
+
// Add a new character
else {
// Shift everything right from the cursor by one character. This includes the '\0'. Then inser the new character.