cursive icon indicating copy to clipboard operation
cursive copied to clipboard

[BUG] Blt backend could not resolve "ctrl-f" in the text_area example.

Open bbodi opened this issue 4 years ago • 1 comments

Describe the bug Blt backend could not resolve "ctrl-f" in the text_area example.

To Reproduce cursive\examples> cargo run --features cursive/blt-backend --no-default-features --bin text_area and press ctrl-f in the textarea

Expected behavior The search dialog should op up.

Environment

  • Operating system used Windows 10
  • Backend used: ncurses (the default one), pancurses, crossterm, ... blt

Temporarily I solved it this way

Index: cursive/src/backends/blt.rs
===================================================================
diff --git a/cursive/src/backends/blt.rs b/cursive/src/backends/blt.rs
--- a/cursive/src/backends/blt.rs	(revision 8e252e176bb7b9b4bb1a37b3cdb957d5b92af490)
+++ b/cursive/src/backends/blt.rs	(date 1613718816371)
@@ -374,7 +374,11 @@
 }
 
 fn blt_keycode_to_char(kc: KeyCode, shift: bool) -> char {
-    match bear_lib_terminal::terminal::state::char() {
+    let c = bear_lib_terminal::terminal::state::char();
+    if (c as usize) < 32 /*code for space*/ {
+        return blt_keycode_to_char_impl(kc, shift);
+    }
+    match c {
         '\u{0}' => blt_keycode_to_char_impl(kc, shift),
         c => c,
     }

bbodi avatar Feb 19 '21 07:02 bbodi

Hi, and thanks for the report!

I just tested on linux and ctrl+F is working fine as-is. Could it be a difference between the linux and windows implementation of BLT? :S

gyscos avatar Mar 24 '21 17:03 gyscos