Add term support #19

Merged
ThePerfectComputer merged 7 commits from add_term_support into main 2024-12-30 23:10:28 +00:00
5 changed files with 9 additions and 10 deletions
Showing only changes of commit e08c673e86 - Show all commits

View file

@ -74,8 +74,8 @@ 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 send_char(c : String) {
platform::send_char(c).await
}
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {

View file

@ -58,8 +58,8 @@ pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
.unwrap_throw()
}
pub(super) async fn send_char() {
tauri_glue::send_char()
pub(super) async fn send_char(c : String) {
tauri_glue::send_char(c)
.await
.unwrap_throw()
}
@ -158,7 +158,7 @@ mod tauri_glue {
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
#[wasm_bindgen(catch)]
pub async fn send_char() -> Result<(), JsValue>;
pub async fn send_char(c : String) -> Result<(), JsValue>;
#[wasm_bindgen(catch)]
pub async fn add_decoders(

View file

@ -71,7 +71,7 @@ fn send_char(
MartinKavik commented 2024-12-25 15:41:10 +00:00 (Migrated from github.com)
Review

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
MartinKavik commented 2024-12-25 15:55:51 +00:00 (Migrated from github.com)
Review

.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)

[.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)
MartinKavik commented 2024-12-25 16:12:03 +00:00 (Migrated from github.com)
Review

if .chars().count() is really what you want (see the previous review comment) then you can replace the if's body with something like:

return Some(process_for_ctrl_char(s[0], has_ctrl))
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)) ```
MartinKavik commented 2024-12-25 16:18:54 +00:00 (Migrated from github.com)
Review

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)
ThePerfectComputer commented 2024-12-27 15:22:35 +00:00 (Migrated from github.com)
Review

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.
MartinKavik commented 2024-12-25 15:41:10 +00:00 (Migrated from github.com)
Review

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
MartinKavik commented 2024-12-25 15:55:51 +00:00 (Migrated from github.com)
Review

.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)

[.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)
MartinKavik commented 2024-12-25 16:12:03 +00:00 (Migrated from github.com)
Review

if .chars().count() is really what you want (see the previous review comment) then you can replace the if's body with something like:

return Some(process_for_ctrl_char(s[0], has_ctrl))
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)) ```
MartinKavik commented 2024-12-25 16:18:54 +00:00 (Migrated from github.com)
Review

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)
ThePerfectComputer commented 2024-12-27 15:22:35 +00:00 (Migrated from github.com)
Review

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();
Task::start(async move {
println!("Sending char: {}", &c);
crate::platform::send_char().await;
MartinKavik commented 2024-12-25 15:41:10 +00:00 (Migrated from github.com)
Review

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
MartinKavik commented 2024-12-25 15:55:51 +00:00 (Migrated from github.com)
Review

.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)

[.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)
MartinKavik commented 2024-12-25 16:12:03 +00:00 (Migrated from github.com)
Review

if .chars().count() is really what you want (see the previous review comment) then you can replace the if's body with something like:

return Some(process_for_ctrl_char(s[0], has_ctrl))
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)) ```
MartinKavik commented 2024-12-25 16:18:54 +00:00 (Migrated from github.com)
Review

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)
ThePerfectComputer commented 2024-12-27 15:22:35 +00:00 (Migrated from github.com)
Review

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(send_c.to_string()).await;
MartinKavik commented 2024-12-25 15:41:10 +00:00 (Migrated from github.com)
Review

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
MartinKavik commented 2024-12-25 15:55:51 +00:00 (Migrated from github.com)
Review

.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)

[.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)
MartinKavik commented 2024-12-25 16:12:03 +00:00 (Migrated from github.com)
Review

if .chars().count() is really what you want (see the previous review comment) then you can replace the if's body with something like:

return Some(process_for_ctrl_char(s[0], has_ctrl))
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)) ```
MartinKavik commented 2024-12-25 16:18:54 +00:00 (Migrated from github.com)
Review

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)
ThePerfectComputer commented 2024-12-27 15:22:35 +00:00 (Migrated from github.com)
Review

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;
println!("Sent char: {}", &c);
});

MartinKavik commented 2024-12-25 15:41:10 +00:00 (Migrated from github.com)
Review

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
MartinKavik commented 2024-12-25 15:55:51 +00:00 (Migrated from github.com)
Review

.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)

[.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)
MartinKavik commented 2024-12-25 16:12:03 +00:00 (Migrated from github.com)
Review

if .chars().count() is really what you want (see the previous review comment) then you can replace the if's body with something like:

return Some(process_for_ctrl_char(s[0], has_ctrl))
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)) ```
MartinKavik commented 2024-12-25 16:18:54 +00:00 (Migrated from github.com)
Review

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)
ThePerfectComputer commented 2024-12-27 15:22:35 +00:00 (Migrated from github.com)
Review

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.
MartinKavik commented 2024-12-25 15:41:10 +00:00 (Migrated from github.com)
Review

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
MartinKavik commented 2024-12-25 15:55:51 +00:00 (Migrated from github.com)
Review

.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)

[.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)
MartinKavik commented 2024-12-25 16:12:03 +00:00 (Migrated from github.com)
Review

if .chars().count() is really what you want (see the previous review comment) then you can replace the if's body with something like:

return Some(process_for_ctrl_char(s[0], has_ctrl))
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)) ```
MartinKavik commented 2024-12-25 16:18:54 +00:00 (Migrated from github.com)
Review

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)
ThePerfectComputer commented 2024-12-27 15:22:35 +00:00 (Migrated from github.com)
Review

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.

File diff suppressed because one or more lines are too long

View file

@ -59,9 +59,8 @@ 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 send_char(c : string): Promise<void> {
return await invoke("send_char", { c });
}
export async function add_decoders(decoder_paths: Array<DecoderPath>): Promise<AddedDecodersCount> {