From 8c8995dbf0782ded23d660a6ead0b8154d4e7231 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Sun, 6 Jan 2013 22:19:28 +0100 Subject: [PATCH] Support for backspace when editing track values Closes #57 --- ogl_editor/src/Editor.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ogl_editor/src/Editor.c b/ogl_editor/src/Editor.c index 52c0286..4db6698 100644 --- a/ogl_editor/src/Editor.c +++ b/ogl_editor/src/Editor.c @@ -1378,7 +1378,7 @@ static bool doEditing(int key) if (key == '.' && !is_editing) return false; - if ((key >= '0' && key <= '9') || key == '.' || key == '-') + if ((key >= '0' && key <= '9') || key == '.' || key == '-' || key == EMGUI_KEY_BACKSPACE) { if (!is_editing) { @@ -1386,7 +1386,11 @@ static bool doEditing(int key) is_editing = true; } - s_editBuffer[strlen(s_editBuffer)] = (char)key; + if (key == EMGUI_KEY_BACKSPACE) + s_editBuffer[emaxi(strlen(s_editBuffer) - 1, 0)] = 0; + else + s_editBuffer[strlen(s_editBuffer)] = (char)key; + s_editorData.trackData.editText = s_editBuffer; return true;