Commit Graph

18 Commits

Author SHA1 Message Date
Kirill Chibisov 673710487a
Extract `SizeInfo` from alacritty_terminal
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.
2022-04-06 13:06:39 +03:00
Christian Duerr ed35d033ae
Fix fullwidth char regex search infinite loop
This resolves an issue where the regex search could loop indefinitely
when the end point was defined in a location containing a fullwidth
character, thus skipping over the end before termination.

Fixes #5753.
2022-01-08 20:24:42 +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
Diego Garza 33db289f7f
Fix libxkbcommon-devel package name for openSUSE
Fixes #5586.
2021-11-02 21:32:53 +00:00
Christian Duerr 4dd70ba3a1
Fix clippy warnings 2021-07-03 03:06:52 +00:00
a5ob7r fa2fa39804
Fix regex search regression 2021-06-20 18:01:47 +00:00
Christian Duerr 3e867a0560
Fix crashes with cut-off fullwidth characters
There's a few places in Alacritty where it was assumed that after a
WIDE_CHAR cell, there'd always be a WIDE_CHAR_SPACER. However since
resizes in the alternate screen buffer do not reflow any content, it's
possible to have a WIDE_CHAR without any WIDE_CHAR_SPACER right behind
it.

This patch changes these instances to be more defensive about accepting
potentially unreasonable input data caused by alt screen resizes.

Fixes #5185.
Fixes #5170.
2021-05-28 11:00:37 +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 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 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
Christian Duerr 3dafec076b
Fix search freezing Alacritty
This resolves a regression introduced in 530de00 where searching would
cause a deadlock when the viewport is at the bottom of the scrollback
and a match ends in the last cell.

Fixes #4800.
2021-02-18 20:27:52 +00: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
James McCoy 7291702f6b
Remove all rustc benchmarks
Co-authored-by: Christian Duerr <contact@christianduerr.com>
2021-01-21 19:45:33 +00:00
Christian Duerr 08e111dfae
Fix debug mode crash in vi-less search 2021-01-03 11:24:04 +00:00
Christian Duerr ec42b42ce6
Use dynamic storage for zerowidth characters
The zerowidth characters were conventionally stored in a [char; 5].
This creates problems both by limiting the maximum number of zerowidth
characters and by increasing the cell size beyond what is necessary even
when no zerowidth characters are used.

Instead of storing zerowidth characters as a slice, a new CellExtra
struct is introduced which can store arbitrary optional cell data that
is rarely required. Since this is stored behind an optional pointer
(Option<Box<CellExtra>>), the initialization and dropping in the case
of no extra data are extremely cheap and the size penalty to cells
without this extra data is limited to 8 instead of 20 bytes.

The most noticible difference with this PR should be a reduction in
memory size of up to at least 30% (1.06G -> 733M, 100k scrollback, 72
lines, 280 columns). Since the zerowidth characters are now stored
dynamically, the limit of 5 per cell is also no longer present.
2020-11-05 04:45:14 +00:00
Christian Duerr 96ea5c445e
Fix handling of wrapline flag in last line
This resolves an issue where Alacritty would crash when a wrapline flag
was present in the last column of the last line.

While it should not be possible to achieve this with normal text flow,
it is possible to rotate the content downwards using the `CSI Ps T`
escape, causing this bug to occur.

This also works around other issues like the vi cursor jumping to the
top of the screen when trying to move beyond the last column using the
`l` key. In debug mode this even lead to a crash due to the overflow.

Fixes #4109.
2020-08-12 08:36:24 +00:00
Christian Duerr 142f84efb9
Add support for searching without vi mode
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.
2020-07-15 21:27:32 +00:00
Christian Duerr 46c0f352c4
Add regex scrollback buffer search
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.
2020-07-09 21:45:22 +00:00