minicrossterm/examples
Benjamin Grosse 10c54b0056
Add window_size() for unix (#790)
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".
2023-08-05 15:34:27 +02:00
..
interactive-demo Fix interactive-demo (#783) 2023-04-23 12:41:00 +02:00
event-match-modifiers.rs Add bracketed paste parsing (#693) 2022-08-10 09:16:56 +02:00
event-poll-read.rs Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00
event-read-char-line.rs Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00
event-read.rs Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00
event-stream-async-std.rs Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00
event-stream-tokio.rs Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00
is_tty.rs Add window_size() for unix (#790) 2023-08-05 15:34:27 +02:00
README.md Fix typos (#675) 2022-06-06 18:10:06 +02:00
stderr.rs Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00

Lines of Code MIT Join us on Discord

Crossterm Examples

The examples are compatible with the latest release.

Structure

├── examples
│   └── interactive-test
│   └── event-*
│   └── stderr
File Name Description Topics
examples/interactive-test interactive, walk through, demo cursor, style, event
event-* event reading demos (async) event reading
stderr crossterm over stderr demo raw mode, alternate screen, custom output
is_tty Is this instance a tty ? tty

Run examples

$ cargo run --example [file name]

To run the interactive-demo go into the folder examples/interactive-demo and run cargo run.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.