From 95d862fd5afc5e62504c45c213672ad04f3d9928 Mon Sep 17 00:00:00 2001 From: YX Date: Sun, 10 Oct 2021 17:04:51 +0800 Subject: Fix IME problem (issue #270) --- src/Fl_Input_.cxx | 4 +++- src/Fl_Text_Display.cxx | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index b3dde0f25..75bd51c4b 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -285,6 +285,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { int desc = height-fl_descent(); float xpos = (float)(X - xscroll_ + 1); int ypos = -yscroll_; + int ypos_cur = 0; //fix issue #270 for (; ypos < H;) { // re-expand line unless it is the last one calculated above: @@ -377,6 +378,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height); } Fl::insertion_point_location((int)xpos+curx, Y+ypos+height, height); + ypos_cur = ypos+height; //fix issue #270 } CONTINUE: @@ -399,7 +401,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { fl_pop_clip(); if (Fl::focus() == this) { fl_set_spot(textfont(), textsize(), - (int)xpos+curx, Y+ypos-fl_descent(), W, H, window()); + (int)xpos+curx, Y+ypos_cur-fl_descent(), W, H, window()); //fix issue #270 } } diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 731d7a94e..ac8a291fe 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -2464,6 +2464,11 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) { for ( int k = 0; k < nSegs; k++ ) { fl_line( segs[ k ].x1, segs[ k ].y1, segs[ k ].x2, segs[ k ].y2 ); } + + //fix issue #270 + if (Fl::focus() == this) { + fl_set_spot(textfont(), textsize(), X, bot, text_area.w, text_area.h, window()); + } } -- cgit v1.2.3