Allow custom input and output destinations#31
Allow custom input and output destinations#31Joannis wants to merge 2 commits intorensbreur:mainfrom
Conversation
|
Hi @Joannis, first of all thank you for your work! These changes seem to be quite specific towards allowing SwiftTUI programs to be sent by a Swift server from a single server process as in your example (because from this issue it looks like using SwiftTUI over ssh already works). That requires the ability to override things such as (for now) how to write to the screen, how to get input and get window resize signals. Regarding issue #13, snapshot testing would require more than just overriding this functionality, as the exact characters written to stdout will depend on implementation details, such as which exact parts of the screen are drawn when and which escape sequences are used to do that. It looks to me like it would be more useful to be able to just get an array of characters from the renderer to do snapshot testing and find out when a view is "ready" (but I don't want to make too large changes to include functionality into SwiftTUI that SwiftUI doesn't have either). That is why I need to think about this some more before merging it into this main repository (of course I'm happy to help also with changes on your own fork). In the mean time here is some minor feedback regarding the specific code: (1) It seems that the SwiftTUI program still sets the input mode. (2) I indeed agree it might be useful to start a SwiftTUI program with an existing run-loop, I was thinking of adding an |
This PR should address #13 , allowing us to communicate outside of
stdinandstdout.startInBackgroundis added so that this library work with structured concurrency, and doesn't require the start to be top-level. In Structured concurrency, the main thread is already active and usable\ris sent by thesshclient when pressing a button. I've made sure buttons can parse that inputAn example implementation: https://github.com/orlandos-nl/Citadel/pull/65/files#diff-81bcbcd2ec23b21cc7b25d541760ca887a9e2819b67b7bbaa939bed4b83ef3df