summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}