1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibLine: Add internal function to erase consecutive spaces under cursor

This commit is contained in:
ronak69 2024-01-13 18:24:12 +00:00 committed by Ali Mohammad Pur
parent 7f2582fca9
commit cb02d52ac9
3 changed files with 19 additions and 0 deletions

View file

@ -579,6 +579,23 @@ void Editor::erase_alnum_word_forwards()
}
}
void Editor::erase_spaces()
{
while (m_cursor < m_buffer.size()) {
if (is_ascii_space(m_buffer[m_cursor]))
erase_character_forwards();
else
break;
}
while (m_cursor > 0) {
if (is_ascii_space(m_buffer[m_cursor - 1]))
erase_character_backwards();
else
break;
}
}
void Editor::case_change_word(Editor::CaseChangeOp change_op)
{
// A word here is contiguous alnums. `foo=bar baz` is three words.