summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-25 00:28:57 +0000
committerrubidium <rubidium@openttd.org>2009-03-25 00:28:57 +0000
commit4a500bbcdb5c1f3b8bfe8dcc454c2d07b210bf88 (patch)
treeb48e687e9a62a9228a3a10a87cd784a8ea06594c
parent4ad9dda5a09fe13288cd276af2d584f5a7663988 (diff)
downloadopenttd-4a500bbcdb5c1f3b8bfe8dcc454c2d07b210bf88.tar.xz
(svn r15843) -Codechange: with RTL the caret would always be drawn at the end of the textbox.
-rw-r--r--src/misc_gui.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 249b9d604..3b2f76453 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1064,7 +1064,10 @@ void QueryString::DrawEditBox(Window *w, int wid)
if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs;
DrawString(delta, tb->width, 0, tb->buf, TC_YELLOW);
- if (HasEditBoxFocus(w, wid) && tb->caret) DrawString(tb->caretxoffs + delta, tb->width + 10, 0, "_", TC_WHITE);
+ if (HasEditBoxFocus(w, wid) && tb->caret) {
+ int caret_width = GetStringBoundingBox("_").width;
+ DrawString(tb->caretxoffs + delta, tb->caretxoffs + delta + caret_width, 0, "_", TC_WHITE);
+ }
_cur_dpi = old_dpi;
}