Add term support #19
|
@ -25,6 +25,7 @@ pub mod theme;
|
|||
use theme::*;
|
||||
|
||||
pub mod term;
|
||||
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||
|
||||
#[derive(Clone, Copy, Default)]
|
||||
enum Layout {
|
||||
|
@ -101,8 +102,11 @@ fn main() {
|
|||
.unwrap_throw()
|
||||
.set_component_text(&component_id, &text),
|
||||
}
|
||||
})
|
||||
.await
|
||||
}).await;
|
||||
platform::listen_term_update(|down_msg| {
|
||||
term::TERMINAL_STATE.set(down_msg);
|
||||
}).await;
|
||||
zoon::println!("Printing on line 106");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -188,11 +192,15 @@ fn root() -> impl Element {
|
|||
TERM_OPEN.signal_cloned().map(
|
||||
|term_open| {
|
||||
match term_open {
|
||||
true => {El::new().child("Terminal")}
|
||||
false => {El::new().child("")}
|
||||
true =>
|
||||
El::new()
|
||||
.s(Height::fill().max(450))
|
||||
.child(term::root()),
|
||||
false =>
|
||||
El::new()
|
||||
.child("")
|
||||
}
|
||||
}
|
||||
)
|
||||
// El::new()
|
||||
)
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ type DiagramConnectorPath = String;
|
|||
type DiagramConnectorName = String;
|
||||
type ComponentId = String;
|
||||
|
||||
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||
|
||||
pub async fn show_window() {
|
||||
platform::show_window().await
|
||||
}
|
||||
|
@ -72,6 +74,10 @@ pub async fn unload_signal(signal_ref: wellen::SignalRef) {
|
|||
platform::unload_signal(signal_ref).await
|
||||
}
|
||||
|
||||
pub async fn send_char() {
|
||||
platform::send_char().await
|
||||
}
|
||||
|
||||
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||
let count = platform::add_decoders(decoder_paths).await;
|
||||
if count > 0 {
|
||||
|
@ -112,6 +118,12 @@ pub async fn listen_diagram_connectors_messages(
|
|||
platform::listen_diagram_connectors_messages(on_message).await;
|
||||
}
|
||||
|
||||
pub async fn listen_term_update(
|
||||
on_message: impl FnMut(TerminalDownMsg) + 'static,
|
||||
) {
|
||||
platform::listen_term_update(on_message).await;
|
||||
}
|
||||
|
||||
pub async fn notify_diagram_connector_text_change(
|
||||
diagram_connector: DiagramConnectorName,
|
||||
component_id: ComponentId,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use shared::DiagramConnectorMessage;
|
||||
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||
use zoon::*;
|
||||
|
||||
pub(super) async fn show_window() {
|
||||
|
@ -57,6 +58,12 @@ pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
|
|||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn send_char() {
|
||||
tauri_glue::send_char()
|
||||
.await
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn add_decoders(
|
||||
decoder_paths: Vec<super::DecoderPath>,
|
||||
) -> super::AddedDecodersCount {
|
||||
|
@ -97,6 +104,14 @@ pub(super) async fn listen_diagram_connectors_messages(
|
|||
tauri_glue::listen_diagram_connectors_messages(Closure::new(on_message).into_js_value()).await
|
||||
}
|
||||
|
||||
pub(super) async fn listen_term_update(
|
||||
mut on_message: impl FnMut(TerminalDownMsg) + 'static,
|
||||
) {
|
||||
let on_message =
|
||||
move |message: JsValue| on_message(serde_wasm_bindgen::from_value(message).unwrap_throw());
|
||||
tauri_glue::listen_term_update(Closure::new(on_message).into_js_value()).await
|
||||
}
|
||||
|
||||
pub(super) async fn notify_diagram_connector_text_change(
|
||||
diagram_connector: super::DiagramConnectorName,
|
||||
component_id: super::ComponentId,
|
||||
|
@ -142,6 +157,9 @@ mod tauri_glue {
|
|||
#[wasm_bindgen(catch)]
|
||||
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn send_char() -> Result<(), JsValue>;
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn add_decoders(
|
||||
decoder_paths: Vec<super::super::DecoderPath>,
|
||||
|
@ -160,6 +178,8 @@ mod tauri_glue {
|
|||
|
||||
pub async fn listen_diagram_connectors_messages(on_event: JsValue);
|
||||
|
||||
pub async fn listen_term_update(on_event: JsValue);
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn notify_diagram_connector_text_change(
|
||||
diagram_connector: super::super::DiagramConnectorName,
|
||||
|
|
|
@ -8,24 +8,11 @@ use shared::term::{TerminalDownMsg, TerminalScreen, TerminalUpMsg};
|
|||
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// use tokio::time::timeout;
|
||||
pub static TERM_OPEN: Lazy<Mutable<bool>> = Lazy::new(|| {false.into()});
|
||||
|
||||
static TERMINAL_STATE: Lazy<Mutable<TerminalDownMsg>> =
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
pub static TERMINAL_STATE: Lazy<Mutable<TerminalDownMsg>> =
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
Lazy::new(|| {
|
||||
Mutable::new(TerminalDownMsg::TermNotStarted)
|
||||
});
|
||||
|
||||
// static CONNECTION: Lazy<Connection<UpMsg, DownMsg>> = Lazy::new(|| {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// Connection::new(
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// |down_msg, _| {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// match down_msg {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// DownMsg::TerminalDownMsg(terminal_msg) => {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// TERMINAL_STATE.set(terminal_msg);
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// }
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// }
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// }
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// )
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// });
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
pub fn root() -> impl Element {
|
||||
term_request();
|
||||
let terminal =
|
||||
|
@ -39,7 +26,6 @@ pub fn root() -> impl Element {
|
|||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
]))
|
||||
.update_raw_el(|raw_el| {
|
||||
raw_el.global_event_handler(|event: events::KeyDown| {
|
||||
println!("Pressed key: {}", &event.key());
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
send_char(
|
||||
(&event).key().as_str(),
|
||||
(&event).ctrl_key(),
|
||||
|
@ -82,7 +68,13 @@ fn send_char(
|
|||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
match process_str(s, has_control) {
|
||||
// TODO : fill this out
|
||||
![]() Replace Replace `match` + `Some` with `if let Some...` (https://doc.rust-lang.org/rust-by-example/flow_control/if_let.html)
|
||||
Some(c) => {
|
||||
eprintln!("Sending char: {}", c);
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
let send_c = c.clone();
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
Task::start(async move {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
println!("Sending char: {}", &c);
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
crate::platform::send_char().await;
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
// crate::platform::unload_signal().await;
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
println!("Sent char: {}", &c);
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
});
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
}
|
||||
None => {eprintln!("Not processing: {}", s)}
|
||||
}
|
||||
|
@ -94,7 +86,7 @@ fn make_grid_with_newlines(term : &TerminalScreen) -> String {
|
|||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
let mut formatted = String::new();
|
||||
for (i, c) in term.content.chars().enumerate() {
|
||||
formatted.push(c);
|
||||
if (i + 1) % term.cols == 0 {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
if ((i + 1) as u16) % term.cols == 0 {
|
||||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
||||
formatted.push('\n');
|
||||
}
|
||||
}
|
||||
|
|
|||
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
![]() please add more context so we both know what should be implemented here without trying to read all related code please add more context so we both know what should be implemented here without trying to read all related code
![]() .chars basically brakes non-ASCII chars. It means when you try to format path like (only applies if the [.chars](https://doc.rust-lang.org/std/primitive.str.html#method.chars) basically brakes non-ASCII chars. It means when you try to format path like `C:\nová složka\můj nový soubor` (`C:\new folder\my new file` in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation
(only applies if the `term` can be a user-defined text)
![]() if
if `.chars().count()` is really what you want (see the previous review comment) then you can replace the `if`'s body with something like:
```rust
return Some(process_for_ctrl_char(s[0], has_ctrl))
```
![]() Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control Perhaps you can use methods like [is_ascii_alphabetic](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_alphabetic) or [is_ascii_lowercase](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_lowercase) or even [is_ascii_control](https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii_control)
![]() Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic. Fully addressing NFC vs NFD unicode behavior will open a can of worms that is non-trivial to resolve. Hopefully, most users have keyboards that input a single unicode point instead of base followed by diacritic.
|
|
@ -38,20 +38,20 @@ export async function get_hierarchy(): Promise<WellenHierarchy> {
|
|||
}
|
||||
|
||||
export async function load_signal_and_get_timeline(
|
||||
signal_ref_index: number,
|
||||
signal_ref_index: number,
|
||||
timeline_zoom: number,
|
||||
timeline_viewport_width: number,
|
||||
timeline_viewport_x: number,
|
||||
timeline_viewport_x: number,
|
||||
block_height: number,
|
||||
var_format: VarFormat,
|
||||
): Promise<Timeline> {
|
||||
return await invoke("load_signal_and_get_timeline", {
|
||||
signal_ref_index,
|
||||
timeline_zoom,
|
||||
return await invoke("load_signal_and_get_timeline", {
|
||||
signal_ref_index,
|
||||
timeline_zoom,
|
||||
timeline_viewport_width,
|
||||
timeline_viewport_x,
|
||||
block_height,
|
||||
var_format
|
||||
block_height,
|
||||
var_format
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,11 @@ export async function unload_signal(signal_ref_index: number): Promise<void> {
|
|||
return await invoke("unload_signal", { signal_ref_index });
|
||||
}
|
||||
|
||||
export async function send_char(): Promise<void> {
|
||||
const char = "a";
|
||||
return await invoke("send_char", { char });
|
||||
}
|
||||
|
||||
export async function add_decoders(decoder_paths: Array<DecoderPath>): Promise<AddedDecodersCount> {
|
||||
return await invoke("add_decoders", { decoder_paths });
|
||||
}
|
||||
|
@ -79,6 +84,10 @@ export async function listen_diagram_connectors_messages(on_message: (message: a
|
|||
return await listen("diagram_connector_message", (message) => on_message(message.payload));
|
||||
}
|
||||
|
||||
export async function listen_term_update(on_message: (message: any) => void) {
|
||||
return await listen("term_content", (message) => on_message(message.payload));
|
||||
}
|
||||
|
||||
export async function notify_diagram_connector_text_change(diagram_connector: DiagramConnectorName, component_id: ComponentId, text: string): Promise<void> {
|
||||
return await invoke("notify_diagram_connector_text_change", { diagram_connector, component_id, text });
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ pub enum TerminalDownMsg {
|
|||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||
#[serde(crate = "serde")]
|
||||
pub struct TerminalScreen {
|
||||
pub cols : usize,
|
||||
pub rows : usize,
|
||||
pub cols : u16,
|
||||
pub rows : u16,
|
||||
pub content : String,
|
||||
}
|
||||
|
|
116
src-tauri/src/aterm.rs
Normal file
|
@ -0,0 +1,116 @@
|
|||
use std::result;
|
||||
use std::sync::{mpsc, Arc};
|
||||
|
||||
use alacritty_terminal::event::{Event, EventListener};
|
||||
use alacritty_terminal::event_loop::{EventLoop, Notifier};
|
||||
use alacritty_terminal::sync::FairMutex;
|
||||
use alacritty_terminal::term::{self, Term};
|
||||
use alacritty_terminal::term::cell::Cell;
|
||||
use alacritty_terminal::{tty, Grid};
|
||||
use tauri::Emitter;
|
||||
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||
|
||||
use crate::terminal_size;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct EventProxy(mpsc::Sender<Event>);
|
||||
impl EventListener for EventProxy {
|
||||
fn send_event(&self, event: Event) {
|
||||
let _ = self.0.send(event.clone());
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ATerm {
|
||||
pub term: Arc<FairMutex<Term<EventProxy>>>,
|
||||
|
||||
rows : u16,
|
||||
cols : u16,
|
||||
|
||||
/// Use tx to write things to terminal instance from outside world
|
||||
pub tx: Notifier,
|
||||
|
||||
/// Use rx to read things from terminal instance.
|
||||
/// Rx only has data when terminal state has changed,
|
||||
/// otherwise, `std::sync::mpsc::recv` will block and sleep
|
||||
/// until there is data.
|
||||
pub rx: mpsc::Receiver<(u64, Event)>,
|
||||
}
|
||||
|
||||
impl ATerm {
|
||||
pub fn new() -> result::Result<ATerm, std::io::Error> {
|
||||
let (rows, cols) = (21, 158);
|
||||
let id = 1;
|
||||
let pty_config = tty::Options {
|
||||
shell: Some(tty::Shell::new("/bin/bash".to_string(), vec![])),
|
||||
..tty::Options::default()
|
||||
};
|
||||
let config = term::Config::default();
|
||||
let terminal_size = terminal_size::TerminalSize::new(rows, cols);
|
||||
let pty = tty::new(&pty_config, terminal_size.into(), id)?;
|
||||
let (event_sender, event_receiver) = mpsc::channel();
|
||||
let event_proxy = EventProxy(event_sender);
|
||||
let term = Term::new::<terminal_size::TerminalSize>(
|
||||
config,
|
||||
&terminal_size.into(),
|
||||
event_proxy.clone(),
|
||||
);
|
||||
let term = Arc::new(FairMutex::new(term));
|
||||
let pty_event_loop = EventLoop::new(term.clone(), event_proxy, pty, false, false)?;
|
||||
let notifier = Notifier(pty_event_loop.channel());
|
||||
let (pty_proxy_sender, pty_proxy_receiver) = std::sync::mpsc::channel();
|
||||
// Start pty event loop
|
||||
pty_event_loop.spawn();
|
||||
std::thread::Builder::new()
|
||||
.name(format!("pty_event_subscription_{}", id))
|
||||
.spawn(move || loop {
|
||||
if let Ok(event) = event_receiver.recv() {
|
||||
if let Event::Exit = event {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if let Some(app_handle) = crate::APP_HANDLE.read().unwrap().clone() {
|
||||
let term = crate::TERM.lock().unwrap();
|
||||
let content = terminal_instance_to_string(&term);
|
||||
let payload = TerminalScreen {
|
||||
cols: term.cols,
|
||||
rows: term.rows,
|
||||
content: content
|
||||
};
|
||||
let payload = TerminalDownMsg::FullTermUpdate(payload);
|
||||
let payload = serde_json::json!(payload);
|
||||
app_handle.emit("term_content", payload).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
})?;
|
||||
Ok(ATerm {
|
||||
term,
|
||||
rows,
|
||||
cols,
|
||||
tx: notifier,
|
||||
rx: pty_proxy_receiver,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn terminal_instance_to_string(terminal_instance: &ATerm) -> String {
|
||||
let (rows, cols) = (terminal_instance.rows, terminal_instance.cols);
|
||||
let term = terminal_instance.term.lock();
|
||||
let grid = term.grid().clone();
|
||||
|
||||
return term_grid_to_string(&grid, rows, cols);
|
||||
}
|
||||
|
||||
fn term_grid_to_string(grid: &Grid<Cell>, rows: u16, cols: u16) -> String {
|
||||
let mut term_content = String::with_capacity((rows*cols) as usize);
|
||||
|
||||
// Populate string from grid
|
||||
for indexed in grid.display_iter() {
|
||||
let x = indexed.point.column.0 as usize;
|
||||
let y = indexed.point.line.0 as usize;
|
||||
if y < rows as usize && x < cols as usize {
|
||||
term_content.push(indexed.c);
|
||||
}
|
||||
}
|
||||
return term_content;
|
||||
}
|
|
@ -24,10 +24,17 @@ type DiagramConnectorName = String;
|
|||
type ComponentId = String;
|
||||
|
||||
mod component_manager;
|
||||
mod aterm;
|
||||
mod terminal_size;
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub static APP_HANDLE: Lazy<Arc<StdRwLock<Option<AppHandle>>>> = Lazy::new(<_>::default);
|
||||
pub static WAVEFORM: Lazy<StdRwLock<Arc<RwLock<Option<Waveform>>>>> = Lazy::new(<_>::default);
|
||||
|
||||
static TERM: Lazy<Mutex<aterm::ATerm>> = Lazy::new(|| {
|
||||
Mutex::new(aterm::ATerm::new().expect("Failed to initialize ATerm"))
|
||||
});
|
||||
|
||||
#[derive(Default)]
|
||||
struct Store {
|
||||
waveform: Arc<RwLock<Option<Waveform>>>,
|
||||
|
@ -146,6 +153,12 @@ async fn unload_signal(signal_ref_index: usize, store: tauri::State<'_, Store>)
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn send_char() -> Result<(), ()> {
|
||||
println!("Sending char: {}", "a");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> Result<AddedDecodersCount, ()> {
|
||||
Ok(component_manager::decoders::add_decoders(decoder_paths).await)
|
||||
|
@ -281,6 +294,7 @@ pub fn run() {
|
|||
get_hierarchy,
|
||||
load_signal_and_get_timeline,
|
||||
unload_signal,
|
||||
send_char,
|
||||
add_decoders,
|
||||
remove_all_decoders,
|
||||
add_diagram_connectors,
|
||||
|
|
please add more context so we both know what should be implemented here without trying to read all related code
.chars basically brakes non-ASCII chars. It means when you try to format path like
C:\nová složka\můj nový soubor
(C:\new folder\my new file
in Czech) then if fails. You should be able to use https://crates.io/crates/unicode-segmentation(only applies if the
term
can be a user-defined text)if
.chars().count()
is really what you want (see the previous review comment) then you can replace theif
's body with something like:Perhaps you can use methods like is_ascii_alphabetic or is_ascii_lowercase or even is_ascii_control