Skip to content

Instantly share code, notes, and snippets.

@esetomo
Created August 15, 2013 17:55
Show Gist options
  • Save esetomo/6243017 to your computer and use it in GitHub Desktop.
Save esetomo/6243017 to your computer and use it in GitHub Desktop.
とりあえずいけたぽい
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2832,12 +2832,13 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
const LLWString textString(getWText());
const llwchar * const text = textString.c_str();
- const S32 line_height = mFont->getLineHeight();
+ const line_info& line = mLineInfoList[current_line];
+ LLRect text_rect(line.mRect);
if (coord)
{
const S32 query_x = mVisibleTextRect.mLeft + mFont->getWidth(text, current_line_start, query - current_line_start);
- const S32 query_y = mVisibleTextRect.mTop - (current_line - first_visible_line) * line_height - line_height / 2;
+ const S32 query_y = (text_rect.mTop + text_rect.mBottom) / 2.0;
S32 query_screen_x, query_screen_y;
localPointToScreen(query_x, query_y, &query_screen_x, &query_screen_y);
LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
@@ -2861,8 +2862,8 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
preedit_right += mFont->getWidth(text, current_line_start, current_line_end - current_line_start);
}
- const S32 preedit_top = mVisibleTextRect.mTop - (current_line - first_visible_line) * line_height;
- const S32 preedit_bottom = preedit_top - line_height;
+ const S32 preedit_top = text_rect.mTop;
+ const S32 preedit_bottom = text_rect.mBottom;
const LLRect preedit_rect_local(preedit_left, preedit_top, preedit_right, preedit_bottom);
LLRect preedit_rect_screen;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment