This change does two things:
- add the serial_test crate to run selected tests serial rather
than in parallel. This is done because they use global state
so running them in parallel leads to race conditions and flaky
results (sometimes they pass, sometimes they fail). Running
them serialy avoids this flakiness.
- create a screen buffer within the test. This avoids changing
the terminal (screen buffer) which is running the test. for
example, a test that changes the terminal size to 20 x 20 can
leave the developer running the test with a resized terminal.
Creating a separate screen buffer for the test avoids this.
It is possible to render images in terminals with protocols such as Sixel,
iTerm2's, or Kitty's. For a basic sixel or iTerm2 image printing, it is
sufficient to print some escape sequence with the data, e.g. cat image just
works, the image is displayed and enough lines are scrolled.
But for more sophisticated usage of images, such as TUIs, it is necessary to
know exactly what area that image would cover, in terms of columns/rows of
characters. Then it would be possible to e.g. resize the image to a size that
fits a col/row area precisely, not overdraw the image area, accommodate layouts,
etc.
Thus, provide the window size in pixel width/height, in addition to cols/rows.
The windows implementation always returns a "not implemented" error. The
windows API exposes a font-size, but in logical units, not pixels.
This could be further extended to expose either "logical window size",
or "pixel font size" and "logical font size".
* Add a function for checking keyboard enhancement support
This follows the Kitty documentation's recommended way to check for
progressive keyboard enhancement: query the flags and then query the
primary device attributes (which is broadly supported). If we receive
only the device attributes, the protocol is not supported.
* Check keyboard enhancement in the event-read example