aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/event_loop.rs
AgeCommit message (Collapse)Author
2023-12-30Passthrough potential errors for `EventLoopSender`Hyper
2023-12-28Derive `Clone` for `EventLoopSender`Hyper
2023-11-10Remove `alacritty_config` from alacritty_terminalKirill Chibisov
There's no need to force alacritty's user configuration on other users of the crate, thus provide the options actually used by alacritty_terminal itself.
2023-10-07Port from mio to pollingJohn Nunley
This patch replaces the mio crate with the polling. Now that smol-rs/polling#96 has been merged, we should be at full feature parity with mio v0.6 now. Fixes #7104. Fixes #6486.
2023-05-23Switch to VTE's built-in ansi featureAnhad Singh
Co-authored-by: Christian Duerr <contact@christianduerr.com>
2023-02-02Update winit to 0.28Kirill Chibisov
Fixes #6644. Fixes #6615. Fixes #6558. Fixes #6515. Fixes #3187. Fixes #62.
2022-06-02Fix a few minor clippy lintsYuri Astrakhan
2022-04-06Extract `SizeInfo` from alacritty_terminalKirill Chibisov
The `SizeInfo` is a SizeInfo used for rendering, which contains information about padding, and such, however all the terminal need is number of visible lines and columns.
2021-12-17Remove outdated Rust compatibility codefee1-dead
2021-11-02Fix libxkbcommon-devel package name for openSUSEDiego Garza
Fixes #5586.
2021-10-23Add multi-window supportChristian Duerr
Previously Alacritty would always initialize only a single terminal emulator window feeding into the winit event loop, however some platforms like macOS expect all windows to be spawned by the same process and this "daemon-mode" can also come with the advantage of increased memory efficiency. The event loop has been restructured to handle all window-specific events only by the event processing context with the associated window id. This makes it possible to add new terminal windows at any time using the WindowContext::new function call. Some preliminary tests have shown that for empty terminals, this reduces the cost of additional terminal emulators from ~100M to ~6M. However at this point the robustness of the daemon against issues with individual terminals has not been refined, making the reliability of this system questionable. New windows can be created either by using the new `CreateNewWindow` action, or with the `alacritty msg create-window` subcommand. The subcommand sends a message to an IPC socket which Alacritty listens on, its location can be found in the `ALACRITTY_SOCKET` environment variable. Fixes #607.
2021-10-11Update rustfmt configurationChristian Duerr
In this change I went through all current rustfmt configuration options and expanded our existing configuration with overrides whenever deemed appropriate. The `normalize_doc_attributes` option is still unstable, but seems to work without any issues. Even when passing macros like `include_str!` that is recognized properly and not normalized. So while this wasn't an issue anywhere in the code, it should make sure it never will be. When it comes to imports there are two new major additions. The `imports_granularity` and `group_imports` options. Both mostly just incorporate unwritten rules that have existed in Alacritty for a long time. Unfortunately since `alacritty_terminal` imports in `alacritty` are supposed to be separate blocks, the `group_imports` option cannot be used.
2021-09-19Handle PTY EIO error for Rust 1.55+Ilya Bobyr
`ErrorKind::Other` no longer includes `EIO` since Rust 1.55: https://blog.rust-lang.org/2021/09/09/Rust-1.55.0.html#stdioerrorkind-variants-updated It was not precise enough from the very beginning, as the comment says that only EIO should be hidden, while the code was any uncategorised errors.
2021-07-08Fix PTY performance regressionsChristian Duerr
The patch 9e7655e introduced some changes which improved rendering with very dense grids, but the automatic benchmarks indicated a slight performance difference in the `dense_cells` benchmark. Caching the terminal lock between iterations rather than always calling `try_lock` resolves that issue. While breaking early in the `WouldBlock` case with `unprocessed != 0` does also help resolve these issues, it shows some more significant fluctuations. Combining both fixes does not help. Additionally on Windows receiving `Ok(0)` from the PTY will also occur instead of a `WouldBlock` error, so handling that fixes freezing on Windows. Fixes #5305.
2021-07-03Add buffer for PTY reads during terminal lockChristian Duerr
Before this patch, Alacritty's PTY reader would always try to read the PTY into a buffer and then wait for the acquisition of the terminal lock to process this data. Since locking for the terminal could take some time, the PTY could fill up with the thread idling while doing so. As a solution, this patch keeps reading to a buffer while the terminal is locked in the renderer and starts processing all buffered data as soon as the lock is released. This has halfed the runtime of a simple `cat` benchmark from ~9 to ~4 seconds when the font size is set to `1`. Running this patch with "normal" grid densities does not appear to make any significant performance differences in either direction. One possible memory optimization for the future would be to use this buffer for synchronized updates, but since this currently uses a dynamic buffer and would be a bit more cluttered, it has not been implemented in this patch.
2021-04-17Fix out of order terminal query responsesChristian Duerr
This forces all responses made to the PTY through the indirection of the UI event loop, making sure that the writes to the PTY are in the same order as the original requests. This just delays all escape sequences by forcing them through the event loop, ideally all responses which are not asynchronous (like a clipboard read) would be made immediately. However since some escapes require feedback from the UI to mutable structures like the config (e.g. color query escapes), this would require additional locking. Fixes #4872.
2021-04-03Add copy/paste/select hint actionsChristian Duerr
This adds some built-in actions for handling hint selections without having to spawn external applications. The new actions are `Copy`, `Select` and `Paste`.
2021-02-24Add support for synchronized updatesChristian Duerr
This implements support for temporarily freezing the terminal grid to prevent rendering of incomplete frames. This can be triggered using the escapes `DCS = 1 s` (start) and `DCS = 2 s` (end). The synchronization is implemented by forwarding all received PTY bytes to a 2 MiB buffer. This should allow updating the entire grid even if it is fairly dense. Unfortunately this also means that another branch is necessary in Alacritty's parser which does have a slight performance impact. In a previous version the freezing was implemented by caching the renderable grid state whenever a synchronized update is started. While this strategy makes it possible to implement this without any performance impact without synchronized updates, a significant performance overhead is introduced whenever a synchronized update is started. Since this can happen thousands of times per frame, it is not a feasible solution. While it would be possible to render at most one synchronized update per frame, it is possible that another synchronized update comes in at any time and stays active for an extended period. As a result the state visible before the long synchronization would be the first received update per frame, not the last, which could lead to the user missing important information during the long freezing interval. Fixes #598.
2021-02-13Update dependenciesChristian Duerr
This introduces some duplicate dependencies, though they are necessary to build properly without any warnings. Fixes #4735.
2020-12-21Replace serde's derive with custom proc macroChristian Duerr
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.
2020-12-17Fix draining of PTY when holding on exitChristian Duerr
Fixes #4189.
2020-07-28Bump minimum supported Rust version to 1.43.0Kirill Chibisov
2020-07-11Remove gui dependencies from alacritty_terminalKirill Chibisov
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.
2020-07-10Add option to run command on bell Kirill Chibisov
Fixes #1528.
2020-06-06Remove copyright notice from filesChristian Duerr
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.
2020-05-05Extend style guideline documentationChristian Duerr
2019-12-14Send PTY resize messages through event loopDavid Hewitt
This allows us to clean up the Arcs on windows, as well as tidy up the code on unix a little too. Fixes #3086.
2019-11-16Fix WinPTY freeze on terminationMaciej Makowski
Fixes #2889.
2019-10-09Add --hold CLI flagValentin Ignatev
This implements --hold flag which keeps Alacritty open after its child process exits. Fixes #1165.
2019-10-05Update to winit/glutin EventLoop 2.0Christian Duerr
This takes the latest glutin master to port Alacritty to the EventLoop 2.0 rework. This changes a big part of the event loop handling by pushing the event loop in a separate thread from the renderer and running both in parallel. Fixes #2796. Fixes #2694. Fixes #2643. Fixes #2625. Fixes #2618. Fixes #2601. Fixes #2564. Fixes #2456. Fixes #2438. Fixes #2334. Fixes #2254. Fixes #2217. Fixes #1789. Fixes #1750. Fixes #1125.
2019-09-21Remove outdated TODO/FIXME commentsChristian Duerr
2019-04-28Split alacritty into a separate cratesTheodore Dubois
The crate containing the entry point is called alacritty, and the crate containing everything else is called alacritty_terminal.