Commit Graph

9 Commits

Author SHA1 Message Date
Joe Wilm 6d4e10e2b9 Add test for input
Added a test while debugging arrow keys, no reason to delete it.
2016-07-29 18:27:45 -07:00
Joe Wilm 90e343b36d Early return in input handling
Don't need to handle modifier keys beyond updating state
2016-07-29 18:27:26 -07:00
Joe Wilm 90d66e63fc Switch to write_all in input handler
Make sure all input bytes get flushed
2016-07-29 18:26:51 -07:00
Joe Wilm 4bc4119987 Fix Control-H bug
Glutin sends both a received character and the key pressed event when a
key is pressed.  Because delete and backspace are mapped in reverse by
terminal standards, we ignore the received character 0x07 and 0x7f
values. However, this breaks Control-H since this normally sends 0x07 as
well. The fix here adds handling for Control-H through the input
tracking system.
2016-07-16 12:25:57 -07:00
Joe Wilm 6be23659ef Correctly handle Backspace and Delete
The default characters sent for this were incorrect. Delete now sends
xterm-compatible escapes (dch1, kdch1), and Backspace sends the delete
code 0x7f.
2016-07-04 09:26:50 -07:00
Joe Wilm bc2793a762 Move WriteNotifier type into input module
It's a generic impl of `input::Notify` for `Write` types; as such, it
seems completely reasonable to include in the input module. Moving it
also serves to declutter main.
2016-07-02 08:32:28 -07:00
Joe Wilm c8fd2c090c Add license headers to source files 2016-06-29 20:59:14 -07:00
Joe Wilm 078dd41e37 Function keys send escape sequences
This doesn't currently handle any of the modifiers, but it does mean
applications like `htop` can be used.
2016-06-23 21:24:35 -07:00
Joe Wilm 00223b32c9 Implement special input handling
There's a number of keys/combinations that should emit escape sequences
to the PTY when triggered. This commit adds a framework to support that.
The input::Processor is a type which tracks state of modifier keys. When
special keys (like arrow, function) are detected, the processor pulls up
a list of candidate escapes to send, and picks the first one based on
terminal mode and active modifier keys. The input::Processor is generic
over the thing receiving the escape sequences, the input::Notify type.
Included is a wrapper for `&mut io::Write` which implements
input::Notify and is currently used to connect the processor to the PTY
stream.

This added handling of the APP_CURSOR mode which changes affects input
processing.
2016-06-23 09:48:31 -07:00