Commit Graph

12 Commits

Author SHA1 Message Date
Christian Duerr 91aa683bcd
Rework URL highlighting
This completely reworks URL highlighting to fix two issues which were
caused by the original approach.

The primary issues that were not straight-forward to resolve with the
previous implementation were about handling the URL highlighted content
moving while the highlight is active.

This lead to issues with highlighting with scrolling and when the
display offset was not 0.

The new approach sticks closely to prior art done for the selection,
where the selection is tracked on the grid and updated whenever the
buffer is rotated.

The truncation of URLs was incorrectly assuming input to be just a
single codepoint wide to truncate the end of URLs with unmatching
closing parenthesis. This is now handled properly using Rust's built-in
Unicode support.

This fixes #2231.
This fixes #2225.
2019-03-30 09:23:48 +00:00
Christian Duerr a672f7d553
Add URL hover highlighting
This changes the cursor whenever it moves to a cell which contains
part of a URL.

When a URL is hovered over, all characters that are recognized as part
of the URL will be underlined and the mouse cursor shape will be
changed. After the cursor leaves the URL, the previous hover state is
restored.

This also changes the behavior when clicking an illegal character right
in front of a URL. Previously this would still launch the URL, but strip
the illegal character. Now these clicks are ignored to make sure there's
no mismatch between underline and legal URL click positions
2019-03-19 19:14:17 +00:00
Christian Duerr b1032bcc6b
Add text reflow
Alacritty will now automatically reflow lines and shrink them when they
would usually exceed the new width of the terminal instead of
truncation.

If a line had to be truncated, it will also be reflown into the previous
line after growing the terminal width.

The reflow behavior when not at the bottom of the history is similar to
that of VTE and aims to keep the viewport stationary whenever possible.

Opposed to VTE, reflow will also be performed in the alternate screen
buffer.

There will be bugs when resizing the terminal emulator to a size smaller
than the prompt, though these issues were present in all terminal
emulators with reflow support.

This fixes #591.
2019-03-13 18:55:18 +00:00
Nathan Lilienthal 04707cbba6 Normalize Log Message Strings
The general style for errors, warnings and info messages is to start
with a capitalized letter and end without a period. The main exception
is when dealing with nouns that are clearer with special case handling,
e.g. "macOS failed to work" or "ioctl is borked".
2019-01-07 00:06:57 +00:00
Joe Wilm 217ad9ec28 Upgrade to Rust 2018
This resolves a lot of NLL issues, however full NLL will be necessary to
handle a couple of remaining issues.
2018-12-10 17:53:56 +00:00
Christian Duerr 6265ef91d5
Display errors and warnings
To make sure that all error and information reporting to the user is
unified, all instances of `print!`, `eprint!`, `println!` and
`eprintln!` have been removed and replaced by logging.

When `RUST_LOG` is not specified, the default Alacritty logger now also
prints to both the stderr and a log file. The log file is only created
when a message is written to it and its name is printed to stdout the
first time it is used.

Whenever a warning or an error has been written to the log file/stderr,
a message is now displayed in Alacritty which points to the log file
where the full error is documented.

The message is cleared whenever the screen is cleared using either the
`clear` command or the `Ctrl+L` key binding.

To make sure that log files created by root don't prevent normal users
from interacting with them, the Alacritty log file is `/tmp/Alacritty-$PID.log`.

Since it's still possible that the log file can't be created, the UI
error/warning message now informs the user if the message was only
written to stderr. The reason why it couldn't be created is then printed
to stderr.

To make sure the deletion of the log file at runtime doesn't create any
issues, the file is re-created if a write is attempted without the file
being present.

To help with debugging Alacritty issues, a timestamp and the error
level are printed in all log messages.

All log messages now follow this format:
    [YYYY-MM-DD HH:MM] [LEVEL] Message

Since it's not unusual to spawn a lot of different terminal emulators
without restarting, Alacritty can create a ton of different log files.

To combat this problem, logfiles are removed by default after
Alacritty has been closed. If the user wants to persist the log of a
single session, the `--persistent_logging` option can be used. For
persisting all log files, the `persistent_logging` option can be set in
the configuration file
2018-11-17 14:39:13 +00:00
Christian Duerr f50ca1a54c
Scrollback cleanup
There were some unneeded codeblocks and TODO/XXX comments in the code
that have been removed. All issues marked with TODO/XXX have either been
already resolved or tracking issues exist.
2018-07-21 17:17:41 +00:00
Joe Wilm c61a912f62 Optimize Row::reset
Now, only cells that have been used are cleared. This is achieved by
using a "occupied" memo on the Row itself. The value, `occ`, is updated
wherever the Row is accessed mutably, and it's cleared to zero in
Row::reset.

The tests for grid scroll_up and scroll_down were updated to include a
test on the value `occ` and slightly refactored, but are otherwise
equivalent to the previous implementation of those tests.

Because of the change to the `Row` struct, the ref tests were updated so
Deserialization keeps working as expected.
2018-06-02 09:56:50 -07:00
Joe Wilm b19045da66 Fix BCE ref tests
BCE was broken in attempt to optimize row clearing. The fix is to revert
to passing in the current cursor state when clearing.
2018-06-02 09:56:50 -07:00
Joe Wilm 54314380f0 Fix grid scroll tests 2018-06-02 09:56:50 -07:00
Joe Wilm b0f655ac85 Make tests compile again
Some tests are still not passing, though.

A migration script was added to migrate serialized grids from
pre-scrollback to the current format. The script is included with this
commit for completeness, posterity, and as an example to be used in the
future.

A few tests in grid/tests.rs were removed due to becoming irrelevant.
2018-06-02 09:56:50 -07:00
Joe Wilm 277425956f Move grid Row and tests into submodules
This is part of some cleanup for the grid module as a whole.
2018-06-02 09:24:38 -07:00