remove nana::is_complete

This commit is contained in:
Jinhao 2015-11-30 01:38:15 +08:00
parent b35f293b9e
commit 83161a3843
3 changed files with 5 additions and 44 deletions

View File

@ -125,8 +125,6 @@ namespace nana
namespace nana namespace nana
{ {
bool is_incomplete(const nana::string& str, unsigned pos);
inline unsigned make_rgb(unsigned char red, unsigned char green, unsigned char blue) inline unsigned make_rgb(unsigned char red, unsigned char green, unsigned char blue)
{ {

View File

@ -427,27 +427,3 @@ namespace nana
} }
} }
namespace nana
{
bool is_incomplete(const nana::string& str, unsigned pos)
{
#ifndef NANA_UNICODE
if(pos > str.size())
pos = static_cast<unsigned>(str.size());
const nana::char_t * pstr = str.c_str();
if(pstr[pos] < 0)
{
bool incomp = false;
for(unsigned i = 0; i < pos; ++i)
{
if(pstr[i] < 0)
incomp = !incomp;
else
incomp = false;
}
return incomp;
}
#endif
return false;
}
}

View File

@ -2183,15 +2183,8 @@ namespace nana{ namespace widgets
unsigned erase_number = 1; unsigned erase_number = 1;
--points_.caret.x; --points_.caret.x;
const string_type& lnstr = textbase_.getline(points_.caret.y); auto& lnstr = textbase_.getline(points_.caret.y);
#ifndef NANA_UNICODE
if(is_incomplete(lnstr, points_.caret.x) && (points_.caret.x))
{
textbase_.erase(points_.caret.y, points_.caret.x, 1);
--points_.caret.x;
erase_number = 2;
}
#endif
undo_ptr->set_caret_pos(); undo_ptr->set_caret_pos();
undo_ptr->set_removed(lnstr.substr(points_.caret.x, erase_number)); undo_ptr->set_removed(lnstr.substr(points_.caret.x, erase_number));
auto secondary = behavior_->take_lines(points_.caret.y); auto secondary = behavior_->take_lines(points_.caret.y);
@ -2264,10 +2257,7 @@ namespace nana{ namespace widgets
if(points_.caret.x) if(points_.caret.x)
{ {
--points_.caret.x; --points_.caret.x;
#ifndef NANA_UNICODE
if(is_incomplete(textbase_.getline(points_.caret.y), points_.caret.x))
--points_.caret.x;
#endif
pending = false; pending = false;
bool adjust_y = (attributes_.line_wrapped && behavior_->adjust_caret_into_screen()); bool adjust_y = (attributes_.line_wrapped && behavior_->adjust_caret_into_screen());
if (_m_move_offset_x_while_over_border(-2) || adjust_y) if (_m_move_offset_x_while_over_border(-2) || adjust_y)
@ -2291,14 +2281,11 @@ namespace nana{ namespace widgets
bool do_render = false; bool do_render = false;
if(_m_cancel_select(2) == false) if(_m_cancel_select(2) == false)
{ {
nana::string lnstr = textbase_.getline(points_.caret.y); auto lnstr = textbase_.getline(points_.caret.y);
if(lnstr.size() > points_.caret.x) if(lnstr.size() > points_.caret.x)
{ {
++points_.caret.x; ++points_.caret.x;
#ifndef NANA_UNICODE
if(is_incomplete(lnstr, points_.caret.x))
++points_.caret.x;
#endif
bool adjust_y = (attributes_.line_wrapped && behavior_->adjust_caret_into_screen()); bool adjust_y = (attributes_.line_wrapped && behavior_->adjust_caret_into_screen());
do_render = (_m_move_offset_x_while_over_border(2) || adjust_y); do_render = (_m_move_offset_x_while_over_border(2) || adjust_y);
} }