From c276c508dafd1b4b138347839c1a8fcfd8a6929e Mon Sep 17 00:00:00 2001 From: ac-stef Date: Tue, 22 Apr 2014 11:22:09 +0200 Subject: [PATCH] fix prompt cursor position no more 1-char limit on inputcommand prompts --- source/src/console.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) mode change 100755 => 100644 source/src/console.cpp diff --git a/source/src/console.cpp b/source/src/console.cpp old mode 100755 new mode 100644 index 841f25c7..483e11a0 --- a/source/src/console.cpp +++ b/source/src/console.cpp @@ -120,18 +120,14 @@ void conoutf(const char *s, ...) COMMANDF(strstr, "ss", (char *a, char *b) { intret(strstr(a, b) ? 1 : 0); }); -/** This is the 1.0.4 function - It will substituted by rendercommand_wip - I am putting this temporarily here because it is very difficult to chat in game with the current cursor behavior, - and chatting in this test period is extremelly important : Brahma */ int rendercommand(int x, int y, int w) { - defformatstring(s)("# %s", cmdline.buf); /** I changed the symbol here to differentiate from the > (new talk symbol), - and make clear the console changed to the old players (like me) : Brahma */ + const char *useprompt = cmdprompt ? cmdprompt : "#"; + defformatstring(s)("%s %s", useprompt, cmdline.buf); int width, height; text_bounds(s, width, height, w); y -= height - FONTH; - draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, cmdline.pos>=0 ? cmdline.pos+2 : (int)strlen(s), w); + draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, cmdline.pos>=0 ? cmdline.pos + strlen(useprompt) + 1 : (int)strlen(s), w); return height; }