From 01042aa9b1ff4138d68168b1a44a912c0ffc43e8 Mon Sep 17 00:00:00 2001
From: MrGVSV <gino.valente.code@gmail.com>
Date: Sat, 18 Dec 2021 09:48:43 -0800
Subject: [PATCH] Fixed backspace for textbox input

---
 kayak_widgets/src/text_box.rs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kayak_widgets/src/text_box.rs b/kayak_widgets/src/text_box.rs
index 0da96fe..5d22a3a 100644
--- a/kayak_widgets/src/text_box.rs
+++ b/kayak_widgets/src/text_box.rs
@@ -63,7 +63,7 @@ pub fn TextBox(value: String, on_change: Option<OnChange>) {
             if !cloned_has_focus.get().0 {
                 return;
             }
-            if c == '\u{8}' {
+            if is_backspace(c) {
                 if current_value.len() > 0 {
                     current_value.truncate(current_value.len() - 1);
                 }
@@ -92,3 +92,10 @@ pub fn TextBox(value: String, on_change: Option<OnChange>) {
         </Background>
     }
 }
+
+/// Checks if the given character contains the "Backspace" sequence
+///
+/// Context: [Wikipedia](https://en.wikipedia.org/wiki/Backspace#Common_use)
+fn is_backspace(c: char) -> bool {
+    c == '\u{8}' || c == '\u{7f}'
+}
\ No newline at end of file
-- 
GitLab