Commit Graph

19 Commits

Author SHA1 Message Date
Kirill Chibisov 40bbdce6de
Fix hyperlinks not being keyboard actionable
This fixes a typo in 694a52b which was filtering all hyperlinks, except
only duplicated ones when opening them with keyboard.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2022-07-11 22:54:28 +03:00
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
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 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
a5ob7r 0486c7cb13
Fix vi cursor motion with ScrollPage* actions
This fixes the regression that vi cursor doesn't move to appropriate
position to emulate vi/vim after invokes `ScrollPage*`.

To emulate vi/vim the cursor should move up/down some lines if the
viewport on topmost scrollback buffer or on bottommost one when invokes
`ScrollPage*` action. Otherwise the cursor should look like no movement
relatively on viewport.
2021-07-04 20:01:29 +00:00
a5ob7r 6f135d713a
Fix ScrollHalfPageUp vi cursor motion regression
This regression was introduced in 3bd5ac2.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2021-06-16 08:55:15 +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 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
Christian Duerr 1723e30d25
Use ConfigDeserialize for all config enums
This fixes up all of the remaining enums which are used in the
configuration file to make sure they all support fully case insensitive
deserialization.

Fixes #4611.
2020-12-31 05:52:45 +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
ii41 a754d06b44
Add support for single line terminals
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>
2020-09-27 22:36:08 +00:00
Ayose Cazorla cdf5e51e74
Add escape to report text area size
This implements the escapes `CSI 14 t` and `CSI 18 t` which report the
text area size in pixels and characters.
2020-08-28 22:26:03 +00:00
Christian Duerr ee2c5a6cdd
Unify term dimension calls
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.
2020-08-25 21:24:16 +03: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 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
Kirill Chibisov 4f5f841296
Remove copypasta dependency from alacritty_terminal 2020-06-07 00:33:20 +03:00
Christian Duerr 1dacc99183
Refactor Term/Grid separation
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`.
2020-05-30 20:45:44 +00:00
Christian Duerr 81ce93574f
Extend style guideline documentation 2020-05-05 22:50:23 +00:00
Christian Duerr 1a8cd172e5
Add modal keyboard motion mode
This implements a basic mode for navigating inside of Alacritty's
history with keyboard bindings. They're bound by default to vi's motion
shortcuts but are fully customizable. Since this relies on key bindings
only single key bindings are currently supported (so no `ge`, or
repetition).

Other than navigating the history and moving the viewport, this mode
should enable making use of all available selection modes to copy
content to the clipboard and launch URLs below the cursor.

This also changes the rendering of the block cursor at the side of
selections, since previously it could be inverted to be completely
invisible. Since that would have caused some troubles with this keyboard
selection mode, the block cursor now is no longer inverted when it is at
the edges of a selection.

Fixes #262.
2020-03-18 02:35:08 +00:00