+ if (legal_letter && text_length < gi->text.size)
+ {
+ strcpy(text, gi->text.value);
+ strcpy(&gi->text.value[cursor_pos + 1], &text[cursor_pos]);
+ gi->text.value[cursor_pos] = letter;
+ gi->text.cursor_position++;
+ DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ }
+ else if (key == XK_Left && cursor_pos > 0)
+ {
+ gi->text.cursor_position--;
+ DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ }
+ else if (key == XK_Right && cursor_pos < text_length)
+ {
+ gi->text.cursor_position++;
+ DrawGadget(gi, DG_PRESSED, DG_DIRECT);
+ }
+ else if (key == XK_BackSpace && cursor_pos > 0)