-
|
Again, I have to commend the effort that goes into something like this, with it being almost 20,000 lines of code and with no dependencies, but I was making a similar system with In the meantime while this question is up, I'll dig through the source code in the hopes I can find what I'm looking for. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
|
Thank you for the praise! The lack of dependencies helps with getting this behavior right. I'm one of the Windows console subsystem maintainers and how it reads input is what may be diplomatically described as "not good": https://github.com/crossterm-rs/crossterm/blob/6af9116b6a8ba365d8d8e7a806cbce318498b84d/src/event/source/windows.rs#L49-L51 Every single character you type, will trigger 4 syscalls. Your maximum throughput is then maybe? 10kB/s? People often complain to us that Windows Terminal is laggy - more often than not, they're unknowingly just using poorly written code. For fun, I wrote an example to demonstrate this performance issue. Here's EEAGXPKT6dfyUMaS.mp4The left half goes on for at least another 5min, after which I simply aborted it. The difference is rather comical. In any case, to recognize resizing, on UNIX you need to subscribe to Then, during rendering of a fullscreen application like this, you can emit explicit newlines at the end of each line. This ensures that resizing the terminal, but before your application had a chance your react, the terminal won't try to reflow (word wrap) the lines, which would create an ugly zigzag line. |
Beta Was this translation helpful? Give feedback.
Thank you for the praise! The lack of dependencies helps with getting this behavior right.
crosstermis a good example for this, because it's not really a good abstraction over UNIX and Windows.I'm one of the Windows console subsystem maintainers and how it reads input is what may be diplomatically described as "not good": https://github.com/crossterm-rs/crossterm/blob/6af9116b6a8ba365d8d8e7a806cbce318498b84d/src/event/source/windows.rs#L49-L51
Every single character you type, will trigger 4 syscalls. Your maximum throughput is then maybe? 10kB/s? People often complain to us that Windows Terminal is laggy - more often than not, they're unknowingly just using poorly written code. For fun,…