Implement a TUI client using console_engine#1
Implement a TUI client using console_engine#1VincentFoulon80 wants to merge 11 commits intoLoipesMas:mainfrom
Conversation
LoipesMas
left a comment
There was a problem hiding this comment.
This look really nice, thanks!
I only found a few minor issues.
And if you'd finish what you mentioned in todos, I would definitely merge this, since it's clearly an improvement over what I made.
5e48553 to
73a53b3
Compare
|
I fixed the issues, and also resolved conflicts. I'm working on implementing the rest of the todolist, I'm changing this PR to a draft. Thanks for your review ! |
f181c8c to
59f7a95
Compare
|
I just finished implementing my todolist into this PR, I hope I haven't made too much of a mess, moving all this code around and writing some cryptic code like in Message::print() where I "enabled" text_wrapping by inserting |
LoipesMas
left a comment
There was a problem hiding this comment.
Great!
The code is indeed a bit messy, but I think mainly because it has too much code. I'd suggest abstracting some functions (e.g. the wrapping), so it looks clearer.
Another thing that I would like to see is better error handling. So instead of panicking on incorrect password, just display a message and allow the user to try again.
And maybe address input should be added to login screen as well? But I'm not sure.
|
Thanks for the review ! I'll look into it in detail later. All this motivated me to implement Forms into my TUI crate directly, to simplify the code here but also allow everybody to have access to this kind of input in their own application. I'd be glad if one day you could review the PR out (when I'll be done with it), you've given me some precious advice and I truly appreciate the time you take to help me. Thank you ! |
|
I finally finished my PR to add forms directly into the TUI crate, adding more features like checkboxes and radios, validation... If you ever feel like taking a peek at the code, it's here. Once the PR is merged (in a day or two, in case of someone wanting to review), I'll work on cleaning this mess up once and for all 🙂 |
|
Sorry for the late reply 😅 I got kinda busy and forgot about this. |
|
No worries about this, take your time and thanks a million for your help on this 😄 I'm on my way to adapt my work here to the future release, by the way. It's looking cleaner for sure 😉 |
Remove unused code
7c678e1 to
f031b26
Compare
|
Hello ! Since I released I also took the freedom to change colors of the terminal, to mimic the GUI version Let me know if you see anything I should change |
LoipesMas
left a comment
There was a problem hiding this comment.
Nice!
Only a few minor issues.
Also, as I said before, I think it's better to move address (and port) input to login screen. Unless you have arguments against.
| .chars() | ||
| .enumerate() | ||
| .flat_map(|(i, chr)| { | ||
| if i != 0 && i % screen.get_width() as usize == 0 { | ||
| lines += 1; | ||
| Some('\n') | ||
| } else { | ||
| None | ||
| } | ||
| .into_iter() | ||
| .chain(std::iter::once(chr)) | ||
| }) | ||
| .collect::<String>(); |
There was a problem hiding this comment.
I'd suggest abstracting this out to a separate function for readability and easier changes.
Also I think this code will fail if there is \n in the message (which right now is not allowed because it caused me trouble, but it probably could (and should) be allowed after this PR is merged).
| self.user_list.clear(); | ||
| for entry in new_list { | ||
| self.add_user(entry) | ||
| } |
There was a problem hiding this comment.
Could this be replaced with:
self.user_list = BTreeSet::from(new_list.iter());
self.dirty = true;?
I think this would be clearer. Unless we want something to happen in add_user in the future?
| if !self.user_list.contains(&username) { | ||
| self.dirty = true; | ||
| self.user_list.insert(username); | ||
| } |
There was a problem hiding this comment.
How about:
self.dirty |= !self.user_list.insert(username);?
This should behave the same, because insert already checks if user_list contains the value (and returns if it was there).
| if self.user_list.contains(&username) { | ||
| self.dirty = true; | ||
| self.user_list.remove(&username); | ||
| } |
There was a problem hiding this comment.
And here:
self.dirty |= self.user_list.remove(&username);
Hello !
I wanted to try to implement the TUI client of Accord using my own crate
console_engine.It's more of a "proof-of-concept", so I won't mind if you close this PR right away.
Feel free to comment my code if you see anything wrong, I'm still learning the language so any comment is appreciated.
Here's a changelog of what this PR changes :
🆕 Features
🐞 Bugfixes
\r\nas Enter key instead of the expected\n📋 Todos (for later)
Implement login with the TUI crateImplement auto scrollingAllow moving the text cursorhandle more keyboard keys (home, end, del, ...)