Skip to content

Commit

Permalink
Add support for synchronized updates
Browse files Browse the repository at this point in the history
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 alacritty#598.
  • Loading branch information
chrisduerr committed Feb 5, 2021
1 parent ee3b2ec commit 925a3e8
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 99 deletions.
111 changes: 66 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion alacritty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ copypasta = { version = "0.7.0", default-features = false }
libc = "0.2"
unicode-width = "0.1"
bitflags = "1"
dirs = "2.0.2"
dirs = "3.0.1"

[build-dependencies]
gl_generator = "0.14.0"
Expand Down
4 changes: 2 additions & 2 deletions alacritty_terminal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ log = "0.4"
unicode-width = "0.1"
base64 = "0.12.0"
regex-automata = "0.1.9"
dirs = "2.0.2"
dirs = "3.0.1"

[target.'cfg(unix)'.dependencies]
nix = "0.18.0"
nix = "0.19.0"
signal-hook = { version = "0.1", features = ["mio-support"] }

[target.'cfg(windows)'.dependencies]
Expand Down
Loading

0 comments on commit 925a3e8

Please sign in to comment.