Indent and Unindent Text Editor Actions

This commit is contained in:
Juniper 2025-04-24 17:20:19 -04:00
parent f67785edb5
commit 0b6e0667ae
2 changed files with 16 additions and 0 deletions

View file

@ -106,6 +106,10 @@ pub enum Edit {
Paste(Arc<String>),
/// Break the current line.
Enter,
/// Indent the current line.
Indent,
/// Unindent the current line.
Unindent,
/// Delete the previous character.
Backspace,
/// Delete the next character.

View file

@ -377,6 +377,18 @@ impl editor::Editor for Editor {
Edit::Paste(text) => {
editor.insert_string(&text, None);
}
Edit::Indent => {
editor.action(
font_system.raw(),
cosmic_text::Action::Indent,
);
}
Edit::Unindent => {
editor.action(
font_system.raw(),
cosmic_text::Action::Unindent,
);
}
Edit::Enter => {
editor.action(
font_system.raw(),