Fixed console cursor positioning.
authorBradley Bell <btb@icculus.org>
Sun, 20 Mar 2005 12:21:11 +0000 (12:21 +0000)
committerBradley Bell <btb@icculus.org>
Sun, 20 Mar 2005 12:21:11 +0000 (12:21 +0000)
ChangeLog
console/CON_console.c

index 61a1c98..8497d3e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-03-20  Bradley Bell  <btb@icculus.org>
 
+       * console/CON_console.c: Fixed console cursor positioning.
+
        * main/text.c: revert to Error if text file not found.
 
 2005-03-20  Martin Schaffner  <schaffnerb@gmx.ch>
index 7960173..d7fac73 100644 (file)
@@ -681,7 +681,11 @@ void DrawCommandLine() {
        }
 
        if(Blink) {
-               x = CON_CHAR_BORDER + Topmost->ConsoleSurface->cv_font->ft_w * (Topmost->CursorPos - Topmost->Offset + strlen(Topmost->Prompt));
+               int prompt_width, command_width, h, w;
+
+               gr_get_string_size(Topmost->Prompt, &prompt_width, &h, &w);
+               gr_get_string_size(Topmost->LCommand + Topmost->Offset, &cmd_width, &h, &w);
+               x = CON_CHAR_BORDER + prompt_width + cmd_width;
                orig_color = FG_COLOR;
                if(Topmost->InsMode)
                        gr_string(x, Topmost->ConsoleSurface->cv_h - Topmost->ConsoleSurface->cv_font->ft_h, CON_INS_CURSOR);