small improvement

This commit is contained in:
Jinhao 2017-06-02 05:19:38 +08:00
parent a6c6a84147
commit 4d93c97c44

View File

@ -1245,10 +1245,9 @@ namespace nana{ namespace widgets
return false; return false;
_m_reset(); _m_reset();
impl_->capacities.behavior->pre_calc_lines(width_pixels());
impl_->try_refresh = sync_graph::refresh; impl_->try_refresh = sync_graph::refresh;
_m_reset_content_size(); _m_reset_content_size(true);
return true; return true;
} }
@ -2104,8 +2103,6 @@ namespace nana{ namespace widgets
void text_editor::del() void text_editor::del()
{ {
bool has_erase = true;
if(select_.a == select_.b) if(select_.a == select_.b)
{ {
if(textbase().getline(points_.caret.y).size() > points_.caret.x) if(textbase().getline(points_.caret.y).size() > points_.caret.x)
@ -2118,12 +2115,10 @@ namespace nana{ namespace widgets
++points_.caret.y; ++points_.caret.y;
} }
else else
has_erase = false; //No characters behind the caret return; //No characters behind the caret
} }
if(has_erase) backspace(); backspace();
_m_reset_content_size();
} }
void text_editor::backspace(bool record_undo) void text_editor::backspace(bool record_undo)
@ -2847,7 +2842,7 @@ namespace nana{ namespace widgets
else else
{ {
if (calc_lines) if (calc_lines)
impl_->capacities.behavior->pre_calc_lines(0); impl_->capacities.behavior->pre_calc_lines(width_pixels());
auto maxline = textbase().max_line(); auto maxline = textbase().max_line();
csize.width = _m_text_extent_size(textbase().getline(maxline.first).c_str(), maxline.second).width + caret_size().width; csize.width = _m_text_extent_size(textbase().getline(maxline.first).c_str(), maxline.second).width + caret_size().width;