From ab259fd006b7dfea1639be06e51ac3407f48c031 Mon Sep 17 00:00:00 2001
From: sam edelsten <samedelsten1@gmail.com>
Date: Sat, 9 Sep 2023 16:01:47 +0100
Subject: [PATCH] correct shift then backspace bug for wasm too

---
 src/lib.rs | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index 2c15ba9..9f09020 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -959,6 +959,13 @@ pub fn cosmic_edit_bevy_events(
                 return;
             }
 
+            // 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);
+                }
+            }
+
             let mut is_edit = is_clipboard;
             let mut is_return = false;
             if keys.just_pressed(KeyCode::Return) {
@@ -972,15 +979,6 @@ 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