From dd76a20acd16df90457eb7eb11006902f8e3290b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Sep 2010 00:15:20 +0000 Subject: GUI: Fix caret undrawing. (Regression from r48551) Starting with r48551 the caret undrawing caused the text selection color in ListWidgets to be removed. It also added a slight offset to the character next to the undrawn caret. All this is fixed now. svn-id: r52716 --- gui/editable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gui/editable.cpp') diff --git a/gui/editable.cpp b/gui/editable.cpp index 755e34e380..1ebe307bb0 100644 --- a/gui/editable.cpp +++ b/gui/editable.cpp @@ -48,6 +48,7 @@ void EditableWidget::init() { _editScrollOffset = 0; _font = ThemeEngine::kFontStyleBold; + _inversion = ThemeEngine::kTextInversionNone; } EditableWidget::~EditableWidget() { @@ -237,7 +238,7 @@ void EditableWidget::drawCaret(bool erase) { Common::Rect editRect = getEditRect(); int x = editRect.left; - int y = editRect.top + 1; + int y = editRect.top; x += getCaretOffset(); @@ -253,7 +254,7 @@ void EditableWidget::drawCaret(bool erase) { if ((uint)_caretPos < _editString.size()) { GUI::EditableWidget::String chr(_editString[_caretPos]); int chrWidth = g_gui.getCharWidth(_editString[_caretPos], _font); - g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, 0, false, _font); + g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font); } } -- cgit v1.2.3