From 0b6e0667ae3c9d5199b3f09570a2c353fd0b03da Mon Sep 17 00:00:00 2001 From: Juniper <67175453+Ultrasquid9@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:20:19 -0400 Subject: [PATCH] Indent and Unindent Text Editor Actions --- core/src/text/editor.rs | 4 ++++ graphics/src/text/editor.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/core/src/text/editor.rs b/core/src/text/editor.rs index 6921c61c..bee5560d 100644 --- a/core/src/text/editor.rs +++ b/core/src/text/editor.rs @@ -106,6 +106,10 @@ pub enum Edit { Paste(Arc), /// Break the current line. Enter, + /// Indent the current line. + Indent, + /// Unindent the current line. + Unindent, /// Delete the previous character. Backspace, /// Delete the next character. diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs index aaf46a6a..4afd7b12 100644 --- a/graphics/src/text/editor.rs +++ b/graphics/src/text/editor.rs @@ -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(),