Commit Graph

9 Commits

Author SHA1 Message Date
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
absorber f9d83a2836
Add Ctrl+c binding for exiting hint mode 2021-05-08 03:12:34 +00:00
Christian Duerr edf0faf98f
Fix highlighting multiple hints in the same line
Fixes #5010.
2021-04-30 00:23:09 +00:00
Nathan Lilienthal 11cbc439c8 Update vi-mode `Open` config docs for hints 2021-04-26 19:10:00 -04:00
Christian Duerr 7f31275e74
Fix URL highlight in mouse mode without shift
This resolves a regression introduced in 96fc9ec where URLs would get
highlighted on mouse hover while mouse mode is active even when the
shift modifier was not held down.
2021-04-14 01:05:20 +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 cbcc129440
Add copy/paste/select hint actions
This adds some built-in actions for handling hint selections without
having to spawn external applications.

The new actions are `Copy`, `Select` and `Paste`.
2021-04-03 23:52:44 +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