Commit Graph

20 Commits

Author SHA1 Message Date
Christian Duerr 4ddb608563
Add IPC config subcommand
This patch adds a new mechanism for changing configuration options
without editing the configuration file, by sending options to running
instances through `alacritty msg`.

Each window will load Alacritty's configuration file by default and then
accept IPC messages for config updates using the `alacritty msg config`
subcommand. By default all windows will be updated, individual windows
can be addressed using `alacritty msg config --window-id
"$ALACRITTY_WINDOW_ID"`.

Each option will replace the config's current value and cannot be reset
until Alacritty is restarted or the option is overwritten with a new
value.

Configuration options are passed in the format `field.subfield=value`,
where `value` is interpreted as yaml.

Closes #472.
2022-09-01 01:48:38 +03:00
Christian Duerr 3af1940192
Fix CreateNewWindow CLI fallback
The existing behavior for the new CreateNewWindow actions was to always
pass in their own options, which would discard the existing options
configured on the terminal's PTY config.

To fix this the behavior for CreateNewWindow is now the same as for the
initial window creation, the config values are overwritten conditionally
based on their individual presence in the CLI options.

However all temporary CLI options set on the "master" Alacritty
instance are discarded by all future windows.

Fixes #5659.
2021-12-23 12:23:06 +02: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
Kirill Chibisov 12fbd0051c
Draw cursor with rect renderer
This commit makes cursors being drawn via rects, thus it's always above
underlines/strikeouts. Also, since the cursor isn't a glyph anymore, it
can't be obscured due to atlas switching while glyphs are rendered.

Fixes #4404.
Fixes #3471.
2020-12-28 09:45:39 +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
Nathan Lilienthal 9a62f47292
Remove unused Linear newtype. (#4248) 2020-09-24 19:40:57 -04: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
Christian Duerr 7aafbb757d
Remove copyright notice from files
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-06-06 21:49:14 +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
Christian Duerr 64a3115648
Fix selection with invisible start and end
This resolves an issue with the selection clamping, where no selection
would be rendered at all when the start was above the viewport while the
end was below it.
2020-03-07 22:17:38 +00:00
Christian Duerr 6832b86aa7
Fix selection expansion across full-width glyphs
Instead of trying to expand the start and end of a selection across
full-width glyphs, the selection should now only go from its origin to
the end without any kind of expansion.

Instead, the expansion is now done where the cells are actually checked
for their selection status, expanding across the entire full-width glyph
whenever any part of it is selected.

Fixes #3106.
2020-02-07 09:50:18 +03:00
Christian Duerr 3fb631b91c
Fix cut off full width glyphs in last column
This resolves the issue with full width glyphs getting rendered in the
last column. Since they need at least two glyphs, it is not possible to
properly render them in the last column.

Instead of rendering half of the glyph in the last column, with the
other half cut off, an additional spacer is now inserted before the wide
glyph. This means that the specific glyph in question is then three
cells wide.

Fixes #2385.
2020-01-09 23:06:41 +00:00
Christian Duerr b47a88b142
Fix URL highlighting
Fixes #2898.
Fixes #2479.
2019-11-03 21:59:28 +01:00
Christian Duerr 729eef0c93
Update to winit/glutin EventLoop 2.0
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-10-05 02:29:26 +02:00
Christian Duerr 9dddf649a1
Switch to rfind_url for URL detection
This switches to rfind_url for detecting URLs inside the grid. Instead
of expanding at the cursor position, the complete terminal is searched
from the bottom until the visible region is left with no active URL.

Instead of having the field `cur` publicly accessibly on the
`DisplayIterator`, there are the two methods `DisplayIterator::point`
and `DisplayIterator::cell` for accessing the current element of the
iterator now. This allows accessing the current element right after
creating the iterator.

Fixes #2629.
Fixes #2627.
2019-08-01 15:37:01 +00:00
Theodore Dubois dbd8538762 Split alacritty into a separate crates
The crate containing the entry point is called alacritty, and the crate
containing everything else is called alacritty_terminal.
2019-04-28 13:24:58 +00:00