Change-Id: I8a5ebfb3fcbe5936e336da2751178f6cf03165b8
String buffer = m_impl->finalized_text;
cursor = m_impl->finalized_cursor_pos;
int pos = cursor - maxlen_before;
String buffer = m_impl->finalized_text;
cursor = m_impl->finalized_cursor_pos;
int pos = cursor - maxlen_before;
+ if (maxlen_before < 0) pos = 0;
+ if (pos > (int)buffer.length()) pos = (int)buffer.length();
if (pos < 0) pos = 0;
int len = maxlen_after + (cursor - pos);
if (pos < 0) pos = 0;
int len = maxlen_after + (cursor - pos);
- if (len < 0) len = INT_MAX;
+ if (len < 0) len = 0;
+ if (maxlen_after < 0 ) len = String::npos;
text = buffer.substr (pos, len);
} else {
text.clear ();
text = buffer.substr (pos, len);
} else {
text.clear ();