mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
LibLine: Skip initial non-alphanumeric chars in cursor_right_word()
This commit is contained in:
parent
b22be93e66
commit
a6ce86a4b3
1 changed files with 9 additions and 9 deletions
|
@ -105,17 +105,17 @@ void Editor::cursor_left_character()
|
|||
|
||||
void Editor::cursor_right_word()
|
||||
{
|
||||
if (m_cursor < m_buffer.size()) {
|
||||
// Temporarily put a space at the end of our buffer,
|
||||
// doing this greatly simplifies the logic below.
|
||||
m_buffer.append(' ');
|
||||
for (;;) {
|
||||
if (m_cursor >= m_buffer.size())
|
||||
break;
|
||||
if (!is_ascii_alphanumeric(m_buffer[++m_cursor]))
|
||||
auto has_seen_alnum = false;
|
||||
while (m_cursor < m_buffer.size()) {
|
||||
// after seeing at least one alnum, stop at the first non-alnum
|
||||
if (not is_ascii_alphanumeric(m_buffer[m_cursor])) {
|
||||
if (has_seen_alnum)
|
||||
break;
|
||||
} else {
|
||||
has_seen_alnum = true;
|
||||
}
|
||||
m_buffer.take_last();
|
||||
|
||||
++m_cursor;
|
||||
}
|
||||
m_inline_search_cursor = m_cursor;
|
||||
m_search_offset = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue