summaryrefslogtreecommitdiff
path: root/src/console_gui.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:37:48 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:37:48 +0000
commite2ec0ddb030afd4e7bdf08d1a8f3cb9361388eae (patch)
tree1c90e05fa6e94d2b0f1ebf2fff6ff444e2d515ed /src/console_gui.cpp
parentf5e41314922604c160efc4ac18c77056a1b66400 (diff)
downloadopenttd-e2ec0ddb030afd4e7bdf08d1a8f3cb9361388eae.tar.xz
(svn r25690) -Change: [OSX] Position the candidate window at the caret position.
Diffstat (limited to 'src/console_gui.cpp')
-rw-r--r--src/console_gui.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/console_gui.cpp b/src/console_gui.cpp
index d7ef57a44..530cb8bfd 100644
--- a/src/console_gui.cpp
+++ b/src/console_gui.cpp
@@ -346,6 +346,17 @@ struct IConsoleWindow : Window
return pt;
}
+ virtual Rect GetTextBoundingRect(const char *from, const char *to) const
+ {
+ int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0);
+
+ Point p1 = GetCharPosInString(_iconsole_cmdline.buf, from, FS_NORMAL);
+ Point p2 = from != to ? GetCharPosInString(_iconsole_cmdline.buf, from, FS_NORMAL) : p1;
+
+ Rect r = {this->line_offset + delta + p1.x, this->height - this->line_height, this->line_offset + delta + p2.x, this->height};
+ return r;
+ }
+
virtual void OnMouseWheel(int wheel)
{
this->Scroll(-wheel);