magic-wormhole / magic-wormhole.rs

Rust implementation of Magic Wormhole, with new features and enhancements
European Union Public License 1.2
648 stars 72 forks source link

Tab completion #147

Open piegamesde opened 2 years ago

piegamesde commented 2 years ago

When asking for a code input, pressing tab should complete the word that is currently typed. At the moment, we are using the dialoguer crate for input. I don't know if they provide support for tab completion. Otherwise, I'd be fine with switching to a different implementation (different crate or a custom helper function).

a-moreira commented 1 year ago

hey @piegamesde, I'd like to work on this task, if possible. I've already started working on an implementation here: https://github.com/a-moreira/magic-wormhole.rs/pull/1. It seems to be working fine, but I'm unsure how to deal with the nameplate completion.

piegamesde commented 1 year ago

Many thanks, the code looks good so far. Please open a PR on this repository, you opened one on your fork instead (I assume by accident?).

The nameplate completion is a bit more tricky, as it requires implementing some additional server API endpoint. You can give it a shot too if you want to but I'd be happy to merge the completion without the nameplates in the meantime.

a-moreira commented 1 year ago

I opened there on purpose, still working on it. I will open the PR here soon :-)

piegamesde commented 1 year ago

Btw before you waste effort on writing code that already exists: Have a look at src/core/wordlist.rs, there are some stubs and early attempts at building completion.

Regarding the nameplate completion, I've considered it and decided that it's not worth the effort implementing because the UX improvement is really little and nobody uses the feature. Literally, I just tried using nameplate tab completion in the Python implementation for fun and straight up ran into an exception.

a-moreira commented 1 year ago

@piegamesde OK! I'm not able to work on this for next month or so, but will be back to finish it.