From 13669f759156dacce6f8ab8ec91f7b6f788b9bd7 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 12 Jan 2016 02:26:11 +0800 Subject: [PATCH] fix a textbox line-wrap issue that only clears first line --- include/nana/gui/widgets/skeletons/textbase.hpp | 2 ++ source/gui/widgets/skeletons/text_editor.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nana/gui/widgets/skeletons/textbase.hpp b/include/nana/gui/widgets/skeletons/textbase.hpp index 8bab859f..99cc5799 100644 --- a/include/nana/gui/widgets/skeletons/textbase.hpp +++ b/include/nana/gui/widgets/skeletons/textbase.hpp @@ -407,6 +407,8 @@ namespace skeletons { std::deque().swap(text_cont_); attr_max_.reset(); + text_cont_.emplace_back(); //text_cont_ must not be empty + _m_saved(std::string()); } diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 74ff5c3d..34e85650 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -1495,6 +1495,7 @@ namespace nana{ namespace widgets _m_reset(); behavior_->pre_calc_lines(width_pixels()); + render(API::is_focus_ready(window_)); _m_scrollbar(); return true; @@ -1747,6 +1748,7 @@ namespace nana{ namespace widgets { textbase_.erase_all(); _m_reset(); + behavior_->pre_calc_lines(width_pixels()); put(std::move(str)); }