Add term support #19

Merged
ThePerfectComputer merged 7 commits from add_term_support into main 2024-12-30 23:10:28 +00:00
ThePerfectComputer commented 2024-12-25 00:41:40 +00:00 (Migrated from github.com)

FastWave 2.0 now has a built in terminal using Rust Alacritty as the backend.

image
FastWave 2.0 now has a built in terminal using [Rust Alacritty](https://github.com/alacritty/alacritty) as the backend. <img width="988" alt="image" src="https://github.com/user-attachments/assets/1c7ba169-ab1d-4169-808f-8d97a0a3555e" />
ThePerfectComputer commented 2024-12-25 00:44:07 +00:00 (Migrated from github.com)

All you need to do is click on Open Terminal in the header bar.

Some Notes:

  1. Neither terminal resize nor cursor highlighting are currently supported. Such support is planned however for future iterations of Fastwave. The alacritty backend supports both, but I'm currently working on an alternative terminal implementation that uses the MoonZoon backend instead of TauriIPC. This alternative terminal implementation would be part of a larger effort to re-write FastWave to use the MoonZoon backend instead of the TauriIPC as well. Such a re-implementation would be easily amenable to self hosted web sessions of FastWave as well.
  2. Partial(damaged screens) and full screen re-draws are supported as demonstrated by functioning interactive execution of Htop and Vim.
All you need to do is click on `Open Terminal` in the header bar. Some Notes: 1. Neither terminal resize nor cursor highlighting are currently supported. Such support is planned however for future iterations of Fastwave. The alacritty backend supports both, but I'm currently working on an alternative terminal implementation that uses the MoonZoon backend instead of TauriIPC. This alternative terminal implementation would be part of a larger effort to re-write FastWave to use the MoonZoon backend instead of the TauriIPC as well. Such a re-implementation would be easily amenable to self hosted web sessions of FastWave as well. 2. Partial(damaged screens) and full screen re-draws are supported as demonstrated by functioning interactive execution of Htop and Vim.
MartinKavik (Migrated from github.com) requested changes 2024-12-25 16:22:55 +00:00
MartinKavik (Migrated from github.com) commented 2024-12-25 15:35:47 +00:00

remove

remove
MartinKavik (Migrated from github.com) commented 2024-12-25 15:37:28 +00:00
  • if instead of match
  • then run makers format or cargo fmt --all
- `if` instead of `match` - then run `makers format` or `cargo fmt --all`
MartinKavik (Migrated from github.com) commented 2024-12-25 15:41:10 +00:00

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

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

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 (Migrated from github.com) commented 2024-12-25 16:18:54 +00:00

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)
@ -0,0 +46,4 @@
"Term not yet started!".to_string()
},
TerminalDownMsg::BackendTermStartFailure(msg) => {
format!("Error: BackendTermStartFailure: {}", msg)
MartinKavik (Migrated from github.com) commented 2024-12-25 15:39:05 +00:00
                            format!("Error: BackendTermStartFailure: {msg}")
```suggestion format!("Error: BackendTermStartFailure: {msg}") ```
@ -0,0 +62,4 @@
}
fn send_char(
s : &str,
MartinKavik (Migrated from github.com) commented 2024-12-25 15:58:11 +00:00

can we use c: char instead? Ideally everywhere where it makes sense instead of String allocation and passing strings in the methods called send_char.

can we use `c: char` instead? Ideally everywhere where it makes sense instead of String allocation and passing strings in the methods called `send_char`.
@ -0,0 +66,4 @@
has_control : bool,
) {
match process_str(s, has_control) {
Some(c) => {
MartinKavik (Migrated from github.com) commented 2024-12-25 16:01:04 +00:00

Replace match + Some with if let Some... (https://doc.rust-lang.org/rust-by-example/flow_control/if_let.html)

Replace `match` + `Some` with `if let Some...` (https://doc.rust-lang.org/rust-by-example/flow_control/if_let.html)
MartinKavik (Migrated from github.com) commented 2024-12-25 16:22:36 +00:00

Remove or rewrite

Remove or rewrite
MartinKavik (Migrated from github.com) commented 2024-12-25 16:21:41 +00:00

Why are we waiting?

Why are we waiting?
MartinKavik (Migrated from github.com) commented 2024-12-25 16:21:50 +00:00

Typo

Typo
ThePerfectComputer commented 2024-12-25 17:26:00 +00:00 (Migrated from github.com)

I guess it's also worth noting that the terminal feature will probably not work on windows. I will have to think about an acceptable long term solution.

I guess it's also worth noting that the terminal feature will probably not work on windows. I will have to think about an acceptable long term solution.
ThePerfectComputer (Migrated from github.com) reviewed 2024-12-27 12:26:16 +00:00
ThePerfectComputer (Migrated from github.com) commented 2024-12-27 12:26:16 +00:00

We wait in case the frontend starts slightly after the backend. We, don't want the frontend to miss the first term update.

We wait in case the frontend starts slightly after the backend. We, don't want the frontend to miss the first term update.
ThePerfectComputer (Migrated from github.com) reviewed 2024-12-27 15:22:35 +00:00
ThePerfectComputer (Migrated from github.com) commented 2024-12-27 15:22:35 +00:00

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.
Sign in to join this conversation.
No description provided.