accord icon indicating copy to clipboard operation
accord copied to clipboard

Implement a TUI client using console_engine

Open VincentFoulon80 opened this issue 3 years ago • 7 comments

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

  • Fixed Windows terminals sending \r\n as Enter key instead of the expected \n

📋 Todos (for later)

  • ~Implement login with the TUI crate~
  • ~Implement auto scrolling~
  • ~Allow moving the text cursor~
  • ~handle more keyboard keys (home, end, del, ...)~

VincentFoulon80 avatar Apr 30 '22 15:04 VincentFoulon80

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 !

VincentFoulon80 avatar May 01 '22 18:05 VincentFoulon80

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 \n in messages (console_engine only handles text wrapping when we try to print \n characters).

VincentFoulon80 avatar May 01 '22 21:05 VincentFoulon80

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 !

VincentFoulon80 avatar May 03 '22 22:05 VincentFoulon80

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 🙂

VincentFoulon80 avatar May 26 '22 13:05 VincentFoulon80

Sorry for the late reply 😅 I got kinda busy and forgot about this. I can take a look at that PR tomorrow.

LoipesMas avatar May 28 '22 20:05 LoipesMas

No worries about this, take your time and thanks a million for your help on this 😄 If you don't have time to check it it's also fine.

I'm on my way to adapt my work here to the future release, by the way. It's looking cleaner for sure 😉

VincentFoulon80 avatar May 29 '22 15:05 VincentFoulon80

Hello ! Since I released console_engine version 2.4.0, I updated my code here to use the new features. I used clap to manage parameters (like address and port of the server)

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

VincentFoulon80 avatar Jun 04 '22 14:06 VincentFoulon80