fix bug that didn't reset text_editor content offset(#193)
This commit is contained in:
parent
24c1b292cc
commit
d0f217fbac
@ -1661,6 +1661,27 @@ namespace nana{ namespace widgets
|
||||
impl_->counterpart.buffer.make(r.dimension());
|
||||
|
||||
impl_->capacities.behavior->pre_calc_lines(width_pixels());
|
||||
|
||||
if (points_.offset.x > 0)
|
||||
{
|
||||
auto maxline = textbase().max_line();
|
||||
nana::size text_size = _m_text_extent_size(textbase().getline(maxline.first).c_str(), maxline.second);
|
||||
|
||||
text_size.width += 1;
|
||||
|
||||
points_.offset.x = (std::max)(0,
|
||||
static_cast<int>(text_size.width + 1) - static_cast<int>(this->width_pixels())
|
||||
);
|
||||
}
|
||||
|
||||
if (points_.offset.y > 0)
|
||||
{
|
||||
auto const lines = impl_->capacities.behavior->take_lines();
|
||||
auto const scr_lines = this->screen_lines();
|
||||
|
||||
_m_offset_y((std::max)(static_cast<int>(lines)-static_cast<int>(scr_lines), 0));
|
||||
}
|
||||
|
||||
_m_scrollbar();
|
||||
|
||||
move_caret(points_.caret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user