mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:47:35 +00:00
LibGUI: Add casefold_selection function to choose case conversion
Allows the passing of a Casing enum, Lowercase or Uppercase, and converts the selected text accordingly. If Lowercase is passed as the parameter, it converts the selected text to lowercase. If Uppercase is passed as the parameter, it converts the selected text to uppercase.
This commit is contained in:
parent
3b0785a636
commit
45c5f68d8a
2 changed files with 22 additions and 0 deletions
|
@ -1411,4 +1411,19 @@ void VimEditingEngine::move_to_next_empty_lines_block()
|
|||
m_editor->set_cursor(new_cursor);
|
||||
};
|
||||
|
||||
void VimEditingEngine::casefold_selection(Casing casing)
|
||||
{
|
||||
VERIFY(!m_editor.is_null());
|
||||
VERIFY(m_editor->has_selection());
|
||||
|
||||
switch (casing) {
|
||||
case Casing::Uppercase:
|
||||
m_editor->insert_at_cursor_or_replace_selection(m_editor->selected_text().to_uppercase());
|
||||
return;
|
||||
case Casing::Lowercase:
|
||||
m_editor->insert_at_cursor_or_replace_selection(m_editor->selected_text().to_lowercase());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue