This commit is contained in:
Jinhao 2017-08-11 22:42:27 +08:00
parent 930db94fc2
commit c8bbf03ebf

View File

@ -887,6 +887,7 @@ namespace nana{ namespace widgets
return (pos < linemtr_.size() ? linemtr_[pos].take_lines : 0);
}
private:
/// Split a text into multiple sections, a section indicates an english word or a CKJ character
void _m_text_section(const std::wstring& str, std::vector<text_section>& tsec)
{
if (str.empty())
@ -1025,14 +1026,14 @@ namespace nana{ namespace widgets
if (pos)
{
auto chr = text[pos - 1];
if ((std::iswalpha(chr) && !std::isspace(chr)) || chr == '_')
if ((std::iswalpha(chr) && !std::iswspace(chr)) || chr == '_')
return false;
}
if (pos + len < text.size())
{
auto chr = text[pos + len];
if ((std::iswalpha(chr) && !std::isspace(chr)) || chr == '_')
if ((std::iswalpha(chr) && !std::iswspace(chr)) || chr == '_')
return false;
}
@ -1596,18 +1597,6 @@ namespace nana{ namespace widgets
if(!attributes_.enable_caret)
return false;
auto is_whitespace = [](wchar_t c) {
switch (c) {
case L' ':
case L'\t':
case L'\n':
case L'\r':
return true;
default:
return false;
}
};
// Set caret pos by screen point and get the caret pos.
mouse_caret(arg.pos, true);
@ -1616,11 +1605,11 @@ namespace nana{ namespace widgets
const auto& line = impl_->textbase.getline(select_.b.y);
// Expand the selection forward to the word's end.
while (select_.b.x < line.size() && !is_whitespace(line[select_.b.x]))
while (select_.b.x < line.size() && !std::iswspace(line[select_.b.x]))
++select_.b.x;
// Expand the selection backward to the word's start.
while (select_.a.x > 0 && !is_whitespace(line[select_.a.x - 1]))
while (select_.a.x > 0 && !std::iswspace(line[select_.a.x - 1]))
--select_.a.x;
select_.mode_selection = selection::mode::method_selected;
@ -2876,7 +2865,6 @@ namespace nana{ namespace widgets
return ('0' <= ch && ch <= '9');
}
::nana::color text_editor::_m_bgcolor() const
{
return (!API::window_enabled(window_) ? static_cast<color_rgb>(0xE0E0E0) : API::bgcolor(window_));