Conversation
Owner
Author
|
There is no longer any need for New features include that suggestions for commands are now rendered in lightgray (type |
…e (and how to proceed)
Owner
Author
|
I think this is good now... will see what reports I get in ;) |
hannesm
added a commit
that referenced
this pull request
Feb 7, 2016
Refactor data flow and terminal library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The data flow design was slightly broken, a global
Cli_state.statewas passed around and mutated, by both user input, the rendering loop, and network input. Error handling was done at the beginning of the rendering loop. Also, by using (outdated) Lambda_term/Zed/Camomile libraries, the width of unicode characters (can be 2 columns) lead to UI problems (motivated by 茶 as status line, initially reported by @mirko).Now, there is a rewrite: the main loop renders the state, receives a
state -> state Lwt.tfunction from aLwt_mvar, and continues (unlessquitwas executed).Terminal input handling is done in a separate task (to have
SMP questionsupport, where both a question and a shared secret needs to be entered, anotherLwt_mvaris used (plus a global bool ref, bad bad bad).Commands, navigation, also network input puts something into the
state -> state Lwt.tmvar. Thus, there's a single (immutable!) state (NB: the Contact.contacts still uses a Hashtbl, but should be straightforward to use a Map.t now). To comply with this design, the network interaction needed slight improvement. Error handling is now done while executing the action, and while rendering (instead of having every potentially failing network send wrapped in atry_lwt). Once adisconnecthappens, a reconnect timer is started (viaLwt.asyncfrom the main loop)!The rendering now uses the notty library, which exposes combinators for rendering text. The rendering code is hugely improved (and much more readable), additionally, there is no need anymore to compute width and height manually.
There might be some regression (such as certain key bindings do not work, C-, C-, mark/yank/paste, undo/redo), also smart line wrapping (find whitespace within the last 10 chars) is not implemented yet.