Add term support #19

Merged
ThePerfectComputer merged 7 commits from add_term_support into main 2024-12-30 23:10:28 +00:00
Showing only changes of commit b97f105408 - Show all commits

View file

@ -93,7 +93,6 @@ fn make_grid_with_newlines(term: &TerminalScreen) -> String {
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.
fn process_str(s: &str, has_ctrl: bool) -> Option<char> {
println!("process_str: {s}");
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.
match s {
"Enter" => {return Some('\n');}
"Escape" => {return Some('\x1B');}

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.