aboutsummaryrefslogtreecommitdiff
path: root/src/input.rs
AgeCommit message (Collapse)Author
2017-02-07Semantic SelectionXiaoyu Yin
Fix tests and add line select Refactor BidirectionalIter to remove if blocks Allow for cells tagged with WRAPLINE to continue expanding the selection Reorganize config into structs Add test coverage that callbacks are called Cleanup mouse config - Uses Duration type for ClickHandler::threshold - Removes `action` property from ClickHandler--this can be added in a backwards compatible way later on - Renames ClickState::DblClick to DoubleClick fixup! Cleanup mouse config
2017-02-06Send mouse wheel commands only if they're supportedTuomas Siipola
Fixes #48
2017-02-05Add "Quit" action to allow exit on a Cmd-W or Cmd-QBrandur
Adds a new "Quit" action and binds it to Cmd-W and Cmd-Q on Mac OS in an attempt to make Alacritty feel more like a "normal" citizen of the operating system. Alternatives like Ctrl-D are okay, but I usually want to leave my shells nested within Tmux open even if I exit my terminal. It's also largely selfish: I've built up muscle memory over the years that takes my fingers to Cmd-Q first (and I suspect I'm not the only one). The implementation for an exit is copied from `event.rs` which notably is already tagged with a FIXME. It seems that `tty.rs` contains a `process_should_exit` system to help handle a `SIGCHLD`, and it's possible that these two exit implementations should be merged together. I could probably tackle that as my next project. As mentioned in #218, Alacritty can't really spawn other windows right now, so I've tied in Cmd-W as simply another synonym for quitting until that's implemented. Fixes #218.
2017-02-02Decouple input processing from TermJoe Wilm
Should make input processing much more easily tested.
2017-01-30Load the primary clipboard when pastingjc00ke
Paste & PasteSelection are not quite the same. The former should be pulling from the main clipboard where the latter does not.
2017-01-23Use the log-crate instead of printing to stdoutLukas Lueg
2017-01-08Remove some dead codeJoe Wilm
2017-01-06Fix issue with some international inputsJoe Wilm
cc #87, #55
2017-01-06Clippy fixes!Manish Goregaokar
2017-01-02Send correct character sequence with alt keyJoe Wilm
Resolves #46.
2017-01-02Fix scrolling with SGR modeJoe Wilm
Resolves #43.
2017-01-02Better error message when xclip is not availableJoe Wilm
Resolves #37.
2017-01-01Improve error handling for clipboard actionsJoe Wilm
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.
2017-01-01Add support for SGR mouse reportingJoe Wilm
According to: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
2016-12-29Fix pty read sometimes not triggering drawJoe Wilm
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.
2016-12-29Fix some bugs with selectionsJoe Wilm
Moving the window on macOS would cause a panic in certain circumstances.
2016-12-29Unify Cursor, Location and name it PointJoe Wilm
2016-12-26Implement copying selection for macOSJoe Wilm
Still need automatic loading into selection copy buffer for linux.
2016-12-26Refactor bindings and fix binding testsJoe Wilm
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.
2016-12-26Major cleanup for event handlingJoe Wilm
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.
2016-12-25Refactor input processing to take action contextJoe Wilm
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.
2016-12-22Implement visual component of mouse selectionsJoe Wilm
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.
2016-12-16Rustup and clippyJoe Wilm
All of the changes in this commit are due to clippy lints.
2016-12-12Fix a couple of compiler warningsJoe Wilm
2016-12-11Track terminal cells on mouse movementJoe Wilm
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.
2016-12-11Implement mouse scrolling with line deltasJoe Wilm
This makes scrolling work for mouse wheels (was previously just trackpads).
2016-12-11Add support for bracketed pasteJoe Wilm
Binding/Action execute now has access to TermMode to support bracketed paste mode.
2016-12-11Support trackpad scrollingJoe Wilm
Linebased scrolling is still unsupported (need a mouse to test with).
2016-12-11Support normal mouse tracking modeJoe Wilm
This allows the user for eg clicking columnts in htop to sort.
2016-11-19Add support for recording/running ref testsJoe Wilm
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`.
2016-11-17Make bindings configurable from alacritty.ymlJoe Wilm
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.
2016-11-17Fallback to received chars when no bindingsJoe Wilm
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.
2016-11-11Fix/add some keybindingsJoe Wilm
Adds support for pageup, pagedown, home, and end. Fixes delete inserting spaces. Resolves #15.
2016-10-16Add test exhibiting SIGBUS on my machineJoe Wilm
2016-10-14Rustup and update dependenciesJoe Wilm
Now uses serde_dervive \o/
2016-10-08Start implementing copypasta, a clipboard libraryJoe Wilm
Currently it only supports x11 via the xclip program, and that only supports reading the clipboard contents.
2016-09-27Don't write v when pasting on macOSJoe Wilm
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.
2016-09-26wipJoe Wilm
doesn't work on ubuntu 16.04 for some reason
2016-09-25Refactor EventLoop into event_loop moduleJoe Wilm
This type and its implementations were seriously cluttering main.rs.
2016-09-25Resolve compiler warningsJoe Wilm
2016-09-24Use evented I/O for the ptyJoe Wilm
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.
2016-08-14Fix testsJoe Wilm
Errors/warnings fixed.
2016-07-30Input expects modifier keys from GlutinJoe Wilm
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.
2016-07-29Add test for inputJoe Wilm
Added a test while debugging arrow keys, no reason to delete it.
2016-07-29Early return in input handlingJoe Wilm
Don't need to handle modifier keys beyond updating state
2016-07-29Switch to write_all in input handlerJoe Wilm
Make sure all input bytes get flushed
2016-07-16Fix Control-H bugJoe Wilm
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-04Correctly handle Backspace and DeleteJoe Wilm
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-02Move WriteNotifier type into input moduleJoe Wilm
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-06-29Add license headers to source filesJoe Wilm