aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input.rs
Commit message (Collapse)AuthorAge
* add logo key prefix and alt behavior configuration optionsexperimentalJosh Rahm2021-10-25
|
* Make keybindings more consistent with libtermkeyJosh Rahm2021-10-11
|
* Add some more terminal code stuff.Josh Rahm2021-10-06
| | | | | | | | | | | | - The <Hyper> key now sends <C-M-S-Insert> to make keybinding easier. - the <Ctrl> key with a multibyte character now prepends <C-M-S-Insert> - <Shift-Space> now returns the "\x1b[32;2u" - <Shift-Alt> now sends ""\x1b\x1b[32;2u""
* Relax the ASCII constraint for ALT, and add support for LOGO.Josh Rahm2021-10-03
| | | | | | | | | | | | | | | Traditionally only ASCII characters can be sent with the ALT key. This is an arbitrary restriction than I have relaxed. This means now ALT+ñ will produce '^[ñ' on the terminal as expected. I have also added support for the Windows key to send the escapesequence '\x1b@\x1b\' so a mapping can be created in Vim for something like '<M-@><M-\>t' for Windows+t. In addition, it's worth noting that Glutin does not differentiate between the windows key and the hyper key, so if one is relatively perverse like me and has a hyper key, it can be used to sent logo keys to the terminal without X intercepting it.
* Add ExpandSelection mouse binding actionJason Heard2021-07-29
| | | Fixes #4132.
* Fix clippy warningsChristian Duerr2021-07-03
|
* Improve rendering performanceChristian Duerr2021-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | This PR combines a couple of optimizations to drastically reduce the time it takes to gather everything necessary for rendering Alacritty's terminal grid. To help with the iteration over the grid, the `DisplayIter` which made heavy use of dynamic dispatch has been replaced with a simple addition to the `GridIterator` which also had the benefit of making the code a little easier to understand. The hints/search check for each cell was always performing an array lookup before figuring out that the cell is not part of a hint or search. Since the general case is that the cell is neither part of hints or search, they've been wrapped in an `Option` to make verifying their activity a simple `is_some()` check. For some reason the compiler was also struggling with the `cursor` method of the `RenderableContent`. Since the iterator is explicitly drained, the performance took a hit of multiple milliseconds for a single branch. Our implementation does never reach the case where draining the iterator would be necessary, so this sanity check has just been replaced with a `debug_assert`. Overall this has managed to reduce the time it takes to collect all renderable content from ~7-8ms in my large grid test to just ~3-4ms.
* Fix selection flooding Wayland connectionChristian Duerr2021-04-17
| | | | | | | | | | This resolves an issue where an excessive clipboard update frequency would cause the Wayland display server to ignore necessary selection updates. Instead of copying the selection to the clipboard during the selection process, it is now only copied once the mouse button is released. Fixes #4953.
* Fix mouse reportsChristian Duerr2021-04-16
| | | | | | | The patch 9cb5562 has introduced a regression which would abort if a mouse report's line was bigger than zero, which is the exact opposite of when a mouse report is required. Fixes #4980.
* Fix mouse point crash on resizeChristian Duerr2021-04-15
| | | | | | | | | This resolves an issue with Alacritty crashing after a resize, due to the last cached mouse point being out of bounds. Instead of caching the mouse point, it is now computed on demand to make sure it can never be invalid. Fixes #4977.
* Add vi/mouse hint highlighting supportChristian Duerr2021-04-13
| | | | | This patch removes the old url highlighting code and replaces it with a new implementation making use of hints as sources for finding matches in the terminal.
* Add hide other windows binding on macOSKam Kudla2021-04-08
| | | Fixes #3697.
* Add copy/paste/select hint actionsChristian Duerr2021-04-03
| | | | | | This adds some built-in actions for handling hint selections without having to spawn external applications. The new actions are `Copy`, `Select` and `Paste`.
* Unify the grid line indexing typesChristian Duerr2021-03-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously Alacritty was using two different ways to reference lines in the terminal. Either a `usize`, or a `Line(usize)`. These indexing systems both served different purposes, but made it difficult to reason about logic involving these systems because of its inconsistency. To resolve this issue, a single new `Line(i32)` type has been introduced. All existing references to lines and points now rely on this definition of a line. The indexing starts at the top of the terminal region with the line 0, which matches the line 1 used by escape sequences. Each line in the history becomes increasingly negative and the bottommost line is equal to the number of visible lines minus one. Having a system which goes into the negatives allows following the escape sequence's indexing system closely, while at the same time making it trivial to implement `Ord` for points. The Alacritty UI crate is the only place which has a different indexing system, since rendering and input puts the zero line at the top of the viewport, rather than the top of the terminal region. All instances which refer to a number of lines/columns instead of just a single Line/Column have also been changed to use a `usize` instead. This way a Line/Column will always refer to a specific place in the grid and no confusion is created by having a count of lines as a possible index into the grid storage.
* Add regex terminal hintsChristian Duerr2021-03-01
| | | | | | | | | | | | | | | | This adds support for hints, which allow opening parts of the visual buffer with external programs if they match a certain regex. This is done using a visual overlay triggered on a specified key binding, which then instructs the user which keys they need to press to pass the text to the application. In the future it should be possible to supply some built-in actions for Copy/Pasting the action and using this to launch text when clicking on it with the mouse. But the current implementation should already be useful as-is. Fixes #2792. Fixes #2536.
* Move renderable cell transformation to alacrittyChristian Duerr2021-01-24
| | | | | | | | | | | | This refactors a large chunk of the alacritty_terminal API to expose all data necessary for rendering uniformly through the `renderable_content` call. This also no longer transforms the cells for rendering by a GUI but instead just reports the content from a terminal emulation perspective. The transformation into renderable cells is now done inside the alacritty crate. Since the terminal itself only ever needs to know about modified color RGB values, the configuration for colors was moved to the alacritty UI code.
* Fix jumping between matches in reverse vi searchChristian Duerr2021-01-08
| | | Fixes #4676.
* Fix debug mode crash in vi-less searchChristian Duerr2021-01-03
|
* Remove Windows WinPTY backendChristian Duerr2021-01-01
|
* Fix characters getting swallowed during IME inputChristian Duerr2020-12-31
| | | | | | | | This reverts 1d00883 since it is not necessary anymore after all search bindings are now proper key bindings. This fixes a bug which would cause the first character to be swallowed when using IME after triggering any key binding which doesn't send any `ReceivedCharacter` event. Fixes #4588.
* Draw cursor with rect rendererKirill Chibisov2020-12-28
| | | | | | | | This commit makes cursors being drawn via rects, thus it's always above underlines/strikeouts. Also, since the cursor isn't a glyph anymore, it can't be obscured due to atlas switching while glyphs are rendered. Fixes #4404. Fixes #3471.
* Replace serde's derive with custom proc macroChristian Duerr2020-12-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the existing `Deserialize` derive from serde with a `ConfigDeserialize` derive. The goal of this new proc macro is to allow a more error-friendly deserialization for the Alacritty configuration file without having to manage a lot of boilerplate code inside the configuration modules. The first part of the derive macro is for struct deserialization. This takes structs which have `Default` implemented and will only replace fields which can be successfully deserialized. Otherwise the `log` crate is used for printing errors. Since this deserialization takes the default value from the struct instead of the value, it removes the necessity for creating new types just to implement `Default` on them for deserialization. Additionally, the struct deserialization also checks for `Option` values and makes sure that explicitly specifying `none` as text literal is allowed for all options. The other part of the derive macro is responsible for deserializing enums. While only enums with Unit variants are supported, it will automatically implement a deserializer for these enums which accepts any form of capitalization. Since this custom derive prevents us from using serde's attributes on fields, some of the attributes have been reimplemented for `ConfigDeserialize`. These include `#[config(flatten)]`, `#[config(skip)]` and `#[config(alias = "alias)]`. The flatten attribute is currently limited to at most one per struct. Additionally the `#[config(deprecated = "optional message")]` attribute allows easily defining uniform deprecation messages for fields on structs.
* Add search history supportChristian Duerr2020-12-20
| | | | | | | | | | | | This adds a history to the regex search limited to at most 255 entries. Whenever a search is either confirmed or cancelled, the last regex is entered into the history and can be accessed when a new search is started. This should help users recover complicated search regexes after accidentally discarding them, or handle repeated searches with the same regexes. Fixes #4095.
* Add separate mode for search bindingsChristian Duerr2020-12-19
|
* Fix cursor reports with mouse outside of windowChristian Duerr2020-12-13
| | | | | | | | | | | Previously Alacritty would not report cursor escapes to the application when a mouse button was held down and the mouse was moved. This prevents applications like tmux from updating their selection. Similarly to how windowing libraries keep reporting mouse events when the left mouse button is held down over the window, the escape sequences are now clamped to within the grid and reported to applications. Fixes #4566.
* Add blinking cursor supportDettorer2020-11-23
| | | | | | | | This adds support for blinking the terminal cursor. This can be controlled either using the configuration file, or using escape sequences. The supported control sequences for changing the blinking state are `CSI Ps SP q` and private mode 12.
* Add ability to select text during searchChristian Duerr2020-11-13
| | | | | | | | | | | | | This removes the restriction of not being able to select text while the search is active, making it a bit less jarring of a UX when the user tries to interact with the terminal during search. Since the selection was used during vi-less search to highlight the focused match, there is now an option for a focused match color, which uses the inverted normal match color by default. This focused match is used for both search modes. Other mouse interactions are now also possible during search, like opening URLs or clicking inside of mouse mode applications.
* Add support for single line terminalsii412020-09-27
| | | | | | | | | | | | | | | | | This changes the minimum terminal dimensions from 2 lines and 2 columns, to 1 line and 2 columns. This also reworks the `SizeInfo` to store the number of columns and lines and consistently has only the terminal lines/columns stored, instead of including the message bar and search in some places of the Alacritty renderer/input. These new changes also make it easy to properly start the selection scrolling as soon as the mouse is over the message bar, instead of waiting until it is beyond it. Fixes #4207. Co-authored-by: Christian Duerr <contact@christianduerr.com>
* Add escape to report text area sizeAyose Cazorla2020-08-28
| | | | This implements the escapes `CSI 14 t` and `CSI 18 t` which report the text area size in pixels and characters.
* Unify term dimension callsChristian Duerr2020-08-25
| | | | | | | Since the `Term` implements the `Dimensions` trait itself, we shouldn't call `term.grid()` to call methods from the `Dimensions` trait. This removes all instances of this that I could find in the code at the moment.
* Fix selection scrolling with message bar visibleChristian Duerr2020-08-14
| | | | | | | This resolves an issue with selection scrolling which would cause the selection to wrap to the top of the screen once the cursor enters the padding below the message bar. Fixes #4120.
* Fix characters swallowed during searchChristian Duerr2020-08-09
| | | | This resolves a bug where characters get swallowed when pressing them after pressing backspace before the backspace key is released.
* Add ^C binding to cancel search and leave Vi modeChristian Duerr2020-08-10
| | | | Fixes #4089.
* Fix scrolling with selection expansionChristian Duerr2020-07-27
| | | Fixes #4040.
* Add support for searching without vi modeChristian Duerr2020-07-15
| | | | | | | | This implements search without vi mode by using the selection to track the active search match and advancing it on user input. The keys to go to the next or previous match are not configurable and are bound to enter and shift enter based on Firefox's behavior. Fixes #3937.
* Fix movement within search matchesChristian Duerr2020-07-14
| | | | | | | | | | | | | | | | | Previously the SearchEndNext and SearchEndPrevious match acted exactly like the SearchNext and SearchPrevious action, however this is not how vim works. In vim, regardless of direction the `gN` action always jumps to the next match start to the left of the cursor, while the `gn` action always jumps to the next search end to the right of the cursor. While both approaches might seem reasonable at first, vim's approach has a significant advantage w.r.t. predictability and automation of the movement. By always knowing which direction the motion goes to, this allows for mappings that reliably navigate inside the current match regardless of the global search direction. So deleting until the end of the match would always be `dgn` for example, regardless in which direction the user has jumped to it. Fixes #3953.
* Remove gui dependencies from alacritty_terminalKirill Chibisov2020-07-11
| | | | | | | | This commit removes font dependency from alacritty_terminal, so it'll simplify the usage of alacritty_terminal as a library, since you won't link to system's libraries anymore. It also moves many alacritty related config options from it. Fixes #3393.
* Add readline bindings to searchChristian Duerr2020-07-10
| | | Fixes #3938.
* Add option to run command on bell Kirill Chibisov2020-07-10
| | | Fixes #1528.
* Add regex scrollback buffer searchChristian Duerr2020-07-09
| | | | | | | | | | This adds a new regex search which allows searching the entire scrollback and jumping between matches using the vi mode. All visible matches should be highlighted unless their lines are excessively long. This should help with performance since highlighting is done during render time. Fixes #1017.
* Fix live right-click expansionChristian Duerr2020-06-24
| | | | | | | | While the commit 43c0ad6ea9d2467ccf867a310c4f1e30f5b627c6 introduced right click as a way to expand the active selection, it did not allow for holding right click to continuously do so. This commit remedies that problem by allowing live expansion with while holding the right mouse button.
* Add selection expansionChristian Duerr2020-06-23
| | | | | | | This allows for expanding the selection using the right mouse button. The new selection type depends on the number of clicks and applies to both sides of the selection. Fixes #1554.
* Add automatic scrolling during selectionChristian Duerr2020-06-18
| | | | | | | | | | | | | This adds a new `Scheduler` which allows for staging events to be processed at a later time. If there is a selection active and the mouse is above or below the window, the viewport will now scroll torwards the direction of the mouse. The amount of lines scrolled depends on the distance of the mouse to the boundaries used for selection scrolling. To make it possible to scroll while in fullscreen, the selection scrolling area includes the padding of the window and is at least 5 pixels high in case there is not enough padding present.
* Remove copypasta dependency from alacritty_terminalKirill Chibisov2020-06-07
|
* Remove copyright notice from filesChristian Duerr2020-06-06
| | | | | | | | | | | | | | Keeping the license as part of every file bloats up the files unnecessarily and introduces an additional overhead to the creation of new modules. Since cargo already provides excellent dependency management, most of the code-reuse of Alacritty should occur through Rust's dependency management instead of copying it source. If code is copied partially, copying the license from the main license file should be just as easy as copying from the top of the file and making some adjustments based on where it is used is likely necessary anyways.
* Refactor Shell, Command, and Launcher to share implKirill Chibisov2020-06-05
|
* Refactor Term/Grid separationChristian Duerr2020-05-30
| | | | | | | | | | | This commit aims to clear up the separation between Term and Grid to make way for implementing search. The `cursor` and `cursor_save` have been moved to the grid, since they're always bound to their specific grid and this makes updating easier. Since the selection is independent of the active grid, it has been moved to the `Term`.
* Fix vi ScrollToBottom motionChristian Duerr2020-05-16
| | | | | This resolves an issue with the ScrollToBottom motion in vi mode where it would jump between the first unoccupied cell across wrapped lines and the first unoccupied cell in the current line.
* Don't hide cursor on modifier pressDavid Herberth2020-05-06
| | | Fixes #2761.
* Extend style guideline documentationChristian Duerr2020-05-05
|