Merge pull request #2901 from Ultrasquid9/master

Indent and Unindent Text Editor Actions
This commit is contained in:
Héctor 2025-04-25 04:17:50 +02:00 committed by GitHub
commit 7f1dcec391
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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(),