From fdf375396171f5d2d468c4d824fa001401843508 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 25 Jan 2017 20:24:04 +0800 Subject: [PATCH] fix issues in single line mode of new text_editor wrong caret and text position in single line mode --- source/gui/widgets/skeletons/text_editor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 3ac00606..ad85bd42 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -1377,11 +1377,12 @@ namespace nana{ namespace widgets impl_->capacities.behavior = new behavior_linewrapped(*this); text_area_.vscroll = text_area_.scroll_pixels; text_area_.hscroll = 0; - impl_->capacities.behavior->pre_calc_lines(width_pixels()); } else impl_->capacities.behavior = new behavior_normal(*this); + impl_->capacities.behavior->pre_calc_lines(width_pixels()); + points_.offset.x = 0; _m_offset_y(0); move_caret(upoint{}); @@ -2628,7 +2629,7 @@ namespace nana{ namespace widgets else scrpos.x += _m_text_x(*sct_ptr); - scrpos.y = text_area_.area.y + static_cast((lines - points_.offset.y) * line_height()); + scrpos.y = this->_m_text_top_base() + static_cast((lines - points_.offset.y) * line_height()); return scrpos; }