From 6313a0baa83a58d11ac717b5a70c65bb3f61ffed Mon Sep 17 00:00:00 2001
From: sam edelsten <samedelsten1@gmail.com>
Date: Sat, 9 Sep 2023 11:30:17 +0100
Subject: [PATCH] fix shift requiring extra backspace bug

bit unsure if this is the right way from cosmic-text's standpoint, but it works (:
---
 src/lib.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lib.rs b/src/lib.rs
index 3c5b79c..2c15ba9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -972,6 +972,15 @@ pub fn cosmic_edit_bevy_events(
                 for char_ev in char_evr.iter() {
                     is_edit = true;
                     if *is_deleting {
+                        // fix for issue #8
+                        if let Some(select) = editor.select_opt() {
+                            if editor.cursor().line == select.line
+                                && editor.cursor().index == select.index
+                            {
+                                editor.set_select_opt(None);
+                            }
+                        }
+
                         editor.action(&mut font_system.0, Action::Backspace);
                     } else {
                         editor.action(&mut font_system.0, Action::Insert(char_ev.char));
-- 
GitLab