summaryrefslogtreecommitdiff
path: root/library/Console-windows.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2012-04-17 23:23:45 +0200
committerPetr Mrázek2012-04-17 23:23:45 +0200
commitd825356878eefda3c5ff8cd4395afee9a846f23e (patch)
treeaaeae2505afd912562d54ddbdaa4165b32890fb1 /library/Console-windows.cpp
parentc031349a628afce20355a2d75f74dcacb741ed63 (diff)
downloaddfhack-d825356878eefda3c5ff8cd4395afee9a846f23e.tar.gz
dfhack-d825356878eefda3c5ff8cd4395afee9a846f23e.tar.bz2
dfhack-d825356878eefda3c5ff8cd4395afee9a846f23e.tar.xz
Fix windows console bug
Line input cursor was going crazy when input reached right side of the screen
Diffstat (limited to 'library/Console-windows.cpp')
-rw-r--r--library/Console-windows.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/Console-windows.cpp b/library/Console-windows.cpp
index 8c507d61..d4d47303 100644
--- a/library/Console-windows.cpp
+++ b/library/Console-windows.cpp
@@ -223,12 +223,13 @@ namespace DFHack
size_t plen = prompt.size();
const char * buf = raw_buffer.c_str();
size_t len = raw_buffer.size();
+ int cooked_cursor = raw_cursor;
- while ((plen + raw_cursor) >= cols)
+ while ((plen + cooked_cursor) >= cols)
{
buf++;
len--;
- raw_cursor--;
+ cooked_cursor--;
}
while (plen + len > cols)
{
@@ -247,7 +248,7 @@ namespace DFHack
output(tmp, inf.dwSize.X - (plen + len), len + plen, inf.dwCursorPosition.Y);
free(tmp);
}
- inf.dwCursorPosition.X = (SHORT)(raw_cursor + plen);
+ inf.dwCursorPosition.X = (SHORT)(cooked_cursor + plen);
SetConsoleCursorPosition(console_out, inf.dwCursorPosition);
}