From 7187e692e721fb5752303c2426d35866f2d7b11e Mon Sep 17 00:00:00 2001 From: Jakob Fries Date: Sat, 28 Jul 2007 17:55:50 +0000 Subject: editbox is now even easier to edit --- src/game/client/menu.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 04806fbe..133c5fb5 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -452,14 +452,13 @@ int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int } } - if (k == input::backspace) + if (k == input::backspace && at_index > 0) { - if (at_index > 0) - { - memmove(str + at_index - 1, str + at_index, len - at_index + 1); - at_index--; - } + memmove(str + at_index - 1, str + at_index, len - at_index + 1); + at_index--; } + else if (k == input::delet && at_index < len) + memmove(str + at_index, str + at_index + 1, len - at_index); else if (k == input::enter) ui_clear_last_active_item(); else if (k == input::left && at_index > 0) -- cgit 1.4.1