fix issue that backspace of text_editor in line-wrapped

backspace of text_eidtor in line-wrapped may not work correctly
This commit is contained in:
Jinhao
2017-05-11 00:55:07 +08:00
parent 2281617aa1
commit d936cc4dc6

View File

@@ -2674,7 +2674,7 @@ namespace nana{ namespace widgets
if (whole_line) if (whole_line)
lines = impl_->capacities.behavior->take_lines(row.first); lines = impl_->capacities.behavior->take_lines(row.first);
else else
top += height * row.second; top += static_cast<int>(height * row.second);
const rectangle area_r = { text_area_.area.x, top, width_pixels(), static_cast<unsigned>(height * lines) }; const rectangle area_r = { text_area_.area.x, top, width_pixels(), static_cast<unsigned>(height * lines) };
@@ -2842,7 +2842,7 @@ namespace nana{ namespace widgets
for (auto & ent : reordered) for (auto & ent : reordered)
{ {
auto str_px = static_cast<int>(_m_text_extent_size(ent.begin, ent.end - ent.begin).width); auto str_px = static_cast<int>(_m_text_extent_size(ent.begin, ent.end - ent.begin).width);
if (scrpos.x < str_px) if (scrpos.x <= str_px)
{ {
res.x += _m_char_by_pixels(ent, scrpos.x); res.x += _m_char_by_pixels(ent, scrpos.x);
res.x += static_cast<unsigned>(ent.begin - text_ptr); res.x += static_cast<unsigned>(ent.begin - text_ptr);
@@ -3739,7 +3739,7 @@ namespace nana{ namespace widgets
{ {
for (auto p = pxbuf.get(); p != px_end; ++p) for (auto p = pxbuf.get(); p != px_end; ++p)
{ {
if (pos < *p) if (pos <= *p)
{ {
if ((*p > 1) && (pos >(*p >> 1))) if ((*p > 1) && (pos >(*p >> 1)))
return static_cast<unsigned>(p - pxbuf.get()) + 1; return static_cast<unsigned>(p - pxbuf.get()) + 1;