Commit Graph

183 Commits

Author SHA1 Message Date
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
José Luis Cruz
dfc67e54c8
Fix interactive-demo (#783) 2023-04-23 12:41:00 +02:00
Timon
b2cbd94853
Upgrade to bitflags 2 (#777) 2023-04-08 15:30:43 +02:00
gibbz00
a2c9350ff2
Unwrap crossterm::Result<T, ErrorKind> to std::io::Result. (#765) 2023-04-07 18:17:10 +02:00
lesleyrs
923aaf517b
Fix examples on windows (#775) 2023-04-07 17:10:56 +02:00
Jonathan Dickinson
e065a56536
Add synchronized output/update (#756) 2023-02-26 16:40:13 +01:00
Michael Davis
bca71adad7
Implement "report alternate keys" from the Kitty Keyboard Protocol (#754)
The "report alternate keys" part of the Kitty keyboard protocol will
send an additional codepoint containing the "shifted" version of a
key based on the keyboard layout. This is useful for downstream
applications which set up keybindings based on symbols instead of
exact keys being pressed.

For example, underscore (_) with the Alt modifier is sent as minus (-)
with Alt and Shift modifiers. A terminal will send the underscore
codepoint as an alternate though, and we can use that information and
the presence of the Shift modifier to resolve the symbol. Other
examples are 'A-(' (sent as 'A-S-9') and 'A-)' (sent as 'A-S-0').

This change allows pushing the "report alternate keys" flag and
overwrites the keycode and modifiers for any shifted keys sent by the
terminal.
2023-02-11 10:40:11 +01:00
Timon
614e6a73b7
Add SetCursorStyle command (#742) 2023-01-11 21:04:02 +01:00
Michael Davis
3fe13e18d8
Add a function for checking keyboard enhancement support (#732)
* 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
2023-01-10 19:23:34 +01:00
Leon
bf9f78994a
Fix minor warnings and typos (#726) 2022-12-04 12:41:24 +01:00
Timon
5d02ed8c37
0.25 (#702) 2022-08-10 22:01:18 +02:00
Charlie Groves
1fee5ff30c
Add bracketed paste parsing (#693) 2022-08-10 09:16:56 +02:00
Jesse Weaver
2a612e0f24
Add extra modifiers/state from kitty keyboard protocol (#696) 2022-08-10 09:09:14 +02:00
Lioness100
f59221e1a2
Fix typo in interactive demo (#699) 2022-08-03 14:09:06 +02:00
Jesse Weaver
551659dee3
Add support for functional key codes from kitty keyboard protocol (#691) 2022-07-30 10:33:59 +02:00
Charlie Groves
069497b43b
Emit focus events (#689) 2022-07-28 12:07:01 +02:00
Jesse Weaver
60e51be726
Increase support for kitty enhanced keyboard protocol (#688) 2022-07-24 14:06:46 +02:00
Timon
0c20590774
0.24 (#686) 2022-07-02 21:39:25 +02:00
Timon
0a435e6cb9
Make clear which mouse commands are 0-based and which are 1-based. (#684) 2022-06-30 21:42:57 +02:00
ahoyiski
ad0d100304
Add support for other underline types and the ability to color them (#679) 2022-06-30 21:33:49 +02:00
Timon
645685641a Clarify that SetSize resizes the terminal buffer. 2022-06-30 20:30:36 +02:00
Kian-Meng Ang
21155716e2
Fix typos (#675) 2022-06-06 18:10:06 +02:00
Cl00e9ment
2e5ba7431f
Improve Markdown table formatting (#647) 2022-04-03 15:02:43 +02:00
Timon
a618a9f3b3
0.20 (#567) 2021-06-10 15:55:34 +02:00
nixxquality
176d8beb06
Fix stdout typo (#565) 2021-05-06 10:14:53 +02:00
SirWindfield
b4bdbfc9f3
Remove Unneeded Imports (#552) 2021-03-28 13:49:38 +02:00
Koxiaet
6c0f8ebcf6
Fix clippy warnings (#533) 2021-01-02 15:24:34 +01:00
Timon
e46decc2f3
Fix wrong resize size return (#526) 2020-12-28 10:15:50 +01:00
Koxiaet
5be7d18475
Replace AnsiType with write_ansi (#523) 2020-12-28 07:56:32 +01:00
octotep
6980fce8ec
Disable the mouse capture in the demo to allow scrolling to work (#514) 2020-11-22 13:52:48 +01:00
Blaž Hrastnik
c01693ff78
Rely on futures-core instead of futures-util to speed up compile. (#480) 2020-09-08 08:42:41 +02:00
Sebastian Thiel
d80afb51be
Switch from 'futures' to 'futures-util' crate to reduce dependency count (#454) 2020-07-06 19:10:43 +02:00
Timon
58ef32b40a
Is terminal a tty and reverted feature from 0.17 which introduced a bug. (#405) 2020-03-28 18:38:07 +01:00
Riey
9c9479deb2
Direct write command ansi_codes (#390) 2020-03-10 13:38:38 +01:00
Canop
f58aca9354
Changed vec of Attributes to bitfield (#380) 2020-02-07 14:06:41 +01:00
Timon
b3cf303295
Addes documentation to examples (#348) 2019-12-16 10:13:35 -06:00
Timon
41ff73e3d3
0.14 (#343) 2019-12-13 07:12:35 +01:00
Timon
71029c4a87
Moved some files around (#342) 2019-12-11 17:10:34 +01:00
Timon
47e8366f2b
Moved examples back into crossterm (#332) 2019-12-10 21:07:15 +01:00
Robert Vojta
8fb9059853 Implemented poll Waker. 2019-12-10 20:41:40 +01:00
Timon
b4241e0107
Refactored Screen Module (#336) 2019-12-04 17:40:11 +01:00
Timon
dec0d74b32
Refactored macro's, moved Output, rewrote documentation. (#326) 2019-12-04 17:26:57 +01:00
Timon
f597cfd232
Input module Rewrite (#284) 2019-11-18 21:50:57 +01:00
Zrzka
675c8f5e10 Sub-crates separatation (#251) 2019-09-25 16:09:16 +02:00
Timon
e600eabaed
0.11.0 2019-09-24 19:45:59 +02:00
Zrzka
5216ecbdec API Cleanup - part 3 (#240) 2019-09-20 23:50:53 +02:00
Zrzka
4952cb33d9 API Cleanup - part 2 (#238) 2019-09-19 17:39:14 +02:00
Zrzka
41de9a63a1 API Cleanup - part 1 (#235) 2019-09-19 13:12:16 +02:00
Zrzka
91d07275ad Improved snake example (#231) 2019-09-18 19:31:49 +02:00
Zrzka
05d28b4c5a io::Result to crossterm::Result (#232) 2019-09-18 19:31:12 +02:00