Commit Graph

22 Commits

Author SHA1 Message Date
Kirill Chibisov 933030efd4
Fix terminal not being damage when only font size changed
If font size changes however the cells stay the same the terminal won't
be damaged, since it wasn't resized, however the visual change happened,
thus the entire screen should be damaged.
2022-02-10 23:42:33 +03:00
Kirill Chibisov 73c3dd8628
Add support for drawing undercurls
Fixes #1628.
2022-02-08 20:47:31 +03:00
Kirill Chibisov 8f1abe13e6
Add damage tracking and reporting to compatible compositors
This allows compositors to only process damaged (that is, updated)
regions of our window buffer, which for larger window sizes (think 4k)
should significantly reduce compositing workload under compositors that
support/honor it, which is good for performance, battery life and lower
latency over remote connections like VNC.

On Wayland, clients are expected to always report correct damage, so
this makes us a good citizen there. It can also aid remote desktop
(waypipe, rdp, vnc, ...) and other types of screencopy by having damage
bubble up correctly.

Fixes #3186.
2022-02-02 00:12:58 +03:00
Kirill Chibisov efae2cc80c
Log used display server on Linux/BSD
This also fixes a bug where the welcome log message wasn't logged.
2022-01-30 06:36:35 +00:00
Kirill Chibisov 01c1cc1278
Use `with_position` instead of `set_outer_position`
This uses `with_position` method on a `WindowBuilder` instead of setting
window position on the created window later on.
2022-01-11 20:41:57 +00:00
Kirill Chibisov f7177101ed
Use builtin font for box drawing unicode characters
This commit adds hand rolled drawing of unicode box drawing[1] and
block elements[2] from ranges U+2500 up to U+259f. While using system
font for such characters will look better most of the time, the
characters tend to overlap or not align, so providing builtin font is
the lesser evil here.

[1] - https://www.unicode.org/charts/PDF/U2500.pdf
[2] - https://www.unicode.org/charts/PDF/U2580.pdf

Fixes #5485.
2022-01-06 00:45:06 +03:00
Kirill Chibisov ce59fa4165
Add title/class CLI parameters to create-window
This adds the ability to pass title and class over IPC via the
create-window subcommand, so users can run only one instance for windows
of different spurposes in the window managers of their choice.
2022-01-03 18:55:22 +00:00
Kirill Chibisov 4c6a763850
Bump glutin to 0.28.0
Fixes #5603.
Fixes #5422.
Fixes #5350.
Fixes #4105.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2021-12-03 03:50:14 +00:00
Kirill Chibisov 8681f71084
Add parameters to `msg create-window` subcommand
Alacritty's `msg create-window` subcommand would previously inherit all
the CLI parameters from the original executable. However not only could
this lead to unexpected behavior, it also prevents multi-window users
from making use of parameters like `-e`, `--working-directory`, or
`--hold`.

This is solved by adding a JSON-based message format to the IPC socket
messages which instructs the Alacritty server on which CLI parameters
should be used to create the new window.

Fixes #5562.
Fixes #5561.
Fixes #5560.
2021-11-22 18:34:09 +00:00
Christian Duerr 1df7dc5171
Add multi-window support
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-23 07:16:47 +00:00
Christian Duerr b6e05d2dce
Fix vi indicator obstructing vi mode cursor
Fixes #5504.
2021-09-27 03:51:58 +00:00
Kirill Chibisov c24d7dfd0d
Add option to apply opacity to all background colors
In some cases it could be desired to apply 'background_opacity'
to all background colors instead of just 'colors.primary.background',
thus adding an 'colors.opaque_background_colors' option to control that.

Fixes #741.
2021-08-16 14:49:14 +03:00
Christian Duerr 4dd70ba3a1
Fix clippy warnings 2021-07-03 03:06:52 +00:00
Christian Duerr 0936aa6e8d
Fix unnecessary redraws due to hint highlighting
When the mouse cursor is moved by at least one cell, an update to the
highlighted hints is triggered automatically. Previously this would
always update the hints and redraw Alacritty regardless of the actualy
change to the hint highlighting.

By checking if the hint highlighting has actually changed, pointless
redraws can be prevented. This is especially helpful since mouse motions
often generate a lot of hint re-computations.
2021-05-09 20:44:14 +00:00
Christian Duerr 9cb55621f7
Fix mouse point crash on resize
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.
2021-04-15 22:16:31 +00:00
Christian Duerr 96fc9ecc9a
Add vi/mouse hint highlighting support
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.
2021-04-13 03:24:42 +00:00
Christian Duerr 531e494cf9
Fix focused match selection color
In 3bd5ac221a a regression was introduced
which caused the selection of a focused match to invert the cell color
back to its original color. This was due to the removal of the
`is_match` flag on the renderable cell, which was used to make sure a
cell is not marked as part of a match if it is already part of a
selection.

Instead of relying on a flag that is passed through from content.rs, the
application of the cell colors is instead done in the content.rs file
directly. This not only fixes the bug with selecting the focused match,
but also makes the logic a bit more transparent.

Fixes #4934.
2021-04-02 21:36:35 +00:00
Christian Duerr 3bd5ac221a
Unify the grid line indexing types
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.
2021-03-30 23:25:38 +00:00
Christian Duerr d5dd009a6d
Fix vi mode search
This fixes a regression introduced in a954e07 which caused the vi mode
cursor to be invisible after starting a search.

This was caused by a discrepancy between the search DFA and search
active state, since a search is not active after it has been confirmed
but the DFAs are still present for highlighting.
2021-03-06 03:18:48 +00:00
Christian Duerr a954e076ca
Add regex terminal hints
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.
2021-03-01 19:50:39 +00:00
Nathan Lilienthal a5e2ccd5ab Fix the estimated DPR to 1 on Wayland.
On Wayland, regardless of the underlying scale factor for an output, The
scale factor is 1.0 until we receive the first DPRChanged event. To
correctly calculate the window sizes, we must use a DPR of 1.0 as well.

Ideally we would know what the DPR of the window we're being opened in
is going to be, and avoid the estimation guessing game, but that doesn't
seem possible with the current interfaces provided by the window
systems.
2021-02-04 09:30:10 -05:00
Christian Duerr 530de00049
Move renderable cell transformation to alacritty
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.
2021-01-24 21:45:36 +00:00