aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
Commit message (Collapse)AuthorAge
...
* Use the log-crate instead of printing to stdoutLukas Lueg2017-01-23
|
* Remove some dead codeJoe Wilm2017-01-08
|
* Fix issue with some international inputsJoe Wilm2017-01-06
| | | | cc #87, #55
* Clippy fixes!Manish Goregaokar2017-01-06
|
* Send correct character sequence with alt keyJoe Wilm2017-01-02
| | | | Resolves #46.
* Fix scrolling with SGR modeJoe Wilm2017-01-02
| | | | Resolves #43.
* Better error message when xclip is not availableJoe Wilm2017-01-02
| | | | Resolves #37.
* Improve error handling for clipboard actionsJoe Wilm2017-01-01
| | | | | | Previously, these could have crashed alacritty. Now, they simply print an error message in Red to stderr. The Red format wrapper was moved to a central location where both main.rs and the alacritty lib can access it.
* Add support for SGR mouse reportingJoe Wilm2017-01-01
| | | | | According to: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
* Fix pty read sometimes not triggering drawJoe Wilm2016-12-29
| | | | | | | | | | | There was a lot of complexity around the threadsafe `Flag` type and waking up the event loop. The idea was to prevent unnecessary calls to the glutin window's wakeup_event_loop() method which can be expensive. This complexity made it difficult to get synchronization between the pty reader and the render thread correct. Now, the `dirty` flag on the terminal is also used to prevent spurious wakeups. It is only changed when the mutex is held, so race conditions associated with that flag shouldn't happen.
* Fix some bugs with selectionsJoe Wilm2016-12-29
| | | | Moving the window on macOS would cause a panic in certain circumstances.
* Unify Cursor, Location and name it PointJoe Wilm2016-12-29
|
* Implement copying selection for macOSJoe Wilm2016-12-26
| | | | Still need automatic loading into selection copy buffer for linux.
* Refactor bindings and fix binding testsJoe Wilm2016-12-26
| | | | | | | | | | The somewhat redundant KeyBinding and MouseBinding types were removed in favor of a Binding<T> type. This allows all binding code to be reused for both scenarios. The binding tests were fixed by only asserting on `is_triggered_by()` instead of checking that the action escape sequence was delivered properly.
* Major cleanup for event handlingJoe Wilm2016-12-26
| | | | | | | | | | | | | | | | | | | | | | The event handling code grew organically over time, and with that came a number of warts. The primary issue was with passing some random selection of arguments to the input::Processor based on what the input was. There was the issue that if multiple events were drained from a single PollEventsIterator, the terminal mutex was potentially locked and unlocked many times. Finally, and perhaps most importantly, there was no good way to pass necessary state to the Action executor without going through several API layers. To fix all that, the input::ActionContext and input::Processor are now generated once per call to the event::Processor. The input::Processor holds onto the ActionContext so that it doesn't need to be passed through layers of function calls. When a binding is activated, the ActionContext is simply passed to the handler. This did have the effect of breaking the input::Processor tests (specifically, those relating to bindings). The issue was not addressed in this commit since a larger refactor of the bindings is planned which should also improve testability.
* Refactor input processing to take action contextJoe Wilm2016-12-25
| | | | | | | Various functions take some permutation of the current selection, the terminal, and a notifier. Instead of having to juggle some number of arguments everywhere, the `ActionContext` is constructed and then passed around.
* Implement visual component of mouse selectionsJoe Wilm2016-12-22
| | | | | | This adds the ability to click and drag with the mouse and have the effect of visually selecting text. The ability to copy the selection into a clipboard buffer is not yet implemented.
* Rustup and clippyJoe Wilm2016-12-16
| | | | All of the changes in this commit are due to clippy lints.
* Fix a couple of compiler warningsJoe Wilm2016-12-12
|
* Track terminal cells on mouse movementJoe Wilm2016-12-11
| | | | | | | The cell under the cursor is now tracked in the input processor at `self.mouse.line` and `self.mouse.column`. This could probably be optimized to only compute the cell when in certain states, but the calculation is cheap.
* Implement mouse scrolling with line deltasJoe Wilm2016-12-11
| | | | | This makes scrolling work for mouse wheels (was previously just trackpads).
* Add support for bracketed pasteJoe Wilm2016-12-11
| | | | | Binding/Action execute now has access to TermMode to support bracketed paste mode.
* Support trackpad scrollingJoe Wilm2016-12-11
| | | | Linebased scrolling is still unsupported (need a mouse to test with).
* Support normal mouse tracking modeJoe Wilm2016-12-11
| | | | This allows the user for eg clicking columnts in htop to sort.
* Add support for recording/running ref testsJoe Wilm2016-11-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ref tests use a recording of the terminal protocol and a serialization of the grid state to check that the parsing and action handling systems produce the correct result. Ref tests may be recorded by running alacritty with `--ref-test` and closing the terminal by using the window "X" button. At that point, the recording is fully written to disk, and a serialization of important state is recorded. Those files should be moved to an appropriate folder in the `tests/ref/` tree, and the `ref_test!` macro invocation should be updated accordingly. A couple of changes were necessary to make this work: * Ref tests shouldn't create a pty; the pty was refactored out of the `Term` type. * Repeatable lines/cols were needed; on startup, the terminal is resized * by default to 80x24 though that may be changed by passing `--dimensions w h`. * Calculating window size based on desired rows/columns and font metrics required making load_font callable multiple times. * Refactor types into library crate so they may be imported in an integration test. * A whole bunch of types needed symmetric serialization and deserialization. Mostly this was just adding derives, but the custom deserialization of Rgb had to change to a deserialize_with function. This initially adds one ref test as a sanity check, and more will be added in subsequent commits. This initial ref tests just starts the terminal and runs `ll`.
* Make bindings configurable from alacritty.ymlJoe Wilm2016-11-17
| | | | | | | | | | | | | | | Bindings were previously hardcoded within input.rs; adding, removing, or changing a binding required a recompile! Now, bindings may be declared in alacritty.yml. Even better, bindings are live-reloaded when alacritty.yml is changed! One unexpected benefit of this change was that all of the special casing in input.rs has disappeared. Conversely, config.rs has gained complexity for all of the deserialization logic. Resolves #3.
* Fallback to received chars when no bindingsJoe Wilm2016-11-17
| | | | | Committed this on a plane with no internet; need to get a real glutin ref pushed somewhere and update this commit before merging into master.
* Fix/add some keybindingsJoe Wilm2016-11-11
| | | | | | | Adds support for pageup, pagedown, home, and end. Fixes delete inserting spaces. Resolves #15.
* Add test exhibiting SIGBUS on my machineJoe Wilm2016-10-16
|
* Rustup and update dependenciesJoe Wilm2016-10-14
| | | | Now uses serde_dervive \o/
* Start implementing copypasta, a clipboard libraryJoe Wilm2016-10-08
| | | | | Currently it only supports x11 via the xclip program, and that only supports reading the clipboard contents.
* Don't write v when pasting on macOSJoe Wilm2016-09-27
| | | | | | | This is a bit of an experiment to see if simply handling 'v' in the bindings will work or has any bugs not going through ReceivedCharacter. The change is necessary though to prevent 'v' from being written in front of every clipboard paste.
* wipJoe Wilm2016-09-26
| | | | doesn't work on ubuntu 16.04 for some reason
* Refactor EventLoop into event_loop moduleJoe Wilm2016-09-25
| | | | This type and its implementations were seriously cluttering main.rs.
* Resolve compiler warningsJoe Wilm2016-09-25
|
* Use evented I/O for the ptyJoe Wilm2016-09-24
| | | | | | | | | | This was largely an experiment to see whether writing and reading from a separate thread was causing terminal state corruption as described in https://github.com/jwilm/alacritty/issues/9. Although this doesn't seem to fix that particular issue. Keeping this because it generally seems more correct than reading/writing from separate locations.
* Fix testsJoe Wilm2016-08-14
| | | | Errors/warnings fixed.
* Input expects modifier keys from GlutinJoe Wilm2016-07-30
| | | | | | This is experimental on a separate branch of Glutin. It's intended to fix the problem of certain key events not being delivered on alt-tab and breaking the modifier state tracking.
* Add test for inputJoe Wilm2016-07-29
| | | | Added a test while debugging arrow keys, no reason to delete it.
* Early return in input handlingJoe Wilm2016-07-29
| | | | Don't need to handle modifier keys beyond updating state
* Switch to write_all in input handlerJoe Wilm2016-07-29
| | | | Make sure all input bytes get flushed
* Fix Control-H bugJoe Wilm2016-07-16
| | | | | | | | | 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.
* Correctly handle Backspace and DeleteJoe Wilm2016-07-04
| | | | | | The default characters sent for this were incorrect. Delete now sends xterm-compatible escapes (dch1, kdch1), and Backspace sends the delete code 0x7f.
* Move WriteNotifier type into input moduleJoe Wilm2016-07-02
| | | | | | 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.
* Add license headers to source filesJoe Wilm2016-06-29
|
* Function keys send escape sequencesJoe Wilm2016-06-23
| | | | | This doesn't currently handle any of the modifiers, but it does mean applications like `htop` can be used.
* Implement special input handlingJoe Wilm2016-06-23
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.