Commit graph

412 commits

Author SHA1 Message Date
Christian Duerr 4975be29df
Fix scrolling region performance with fixed lines
This resolves an issue with Alacritty's scrolling region performance
when there's a number of fixed lines at the top of the screen. This
affects commonly used applications like tmux or vim.

Instead of using separate logic for when the scrolling region starts at
the top of the screen without any fixed lines, the code should now try
to figure out the target position of these fixed lines ahead of time,
swap them into place and still perform the optimized implementation to
move the grid.

This comes with the small trade-off that since lines are swapped before
rotating the screen without clearing or removing any lines during the
rotation process, that the places the fixed lines have been swapped with
will appear out of order when using scrolling regions in the primary
screen buffer. Since the use of scrolling regions primarily affects the
alternate screen and most terminals don't keep any history at all, this
should however not cause any problems.
2020-12-10 02:10:24 +00:00
Christian Duerr 9e71002e40
Fix dimming of indexed colors
It seems like the list of colors might have changed a bit, leading to
indexed colors not being transformed into their dim colors correctly.

To prevent this from happening in the future, the dimming for colors in
the range '0..=7' is now performed by offsetting them from the
'NamedColor::DimBlack'. Since this is the first dimmed color, this
should always work as long as all dimmed colors are added in the correct
order.
2020-12-05 12:03:03 +03:00
Christian Duerr a2727d06f7
Fix DoS caused by excessive CSI parameter values 2020-11-26 00:57:44 +00:00
Christian Duerr 0768428190
Remove redundant CLI flags
This removes some of Alacritty's CLI flags since the same functionality
is provided by the '--option' flag now.

The removed flags are:
 * '--persistent-logging'
 * '--live-config-reload'
 * '--no-live-config-reload'
 * '--dimensions'
 * '--position'

Fixes #4246.
2020-11-26 01:49:19 +03:00
Kirill Chibisov 60538d2d7f
Fix CHANGELOG sections
Commit 2fd2db4 added one more 'Added' section during rebase,
thus merging it with existing one.
2020-11-24 03:00:23 +03:00
Dettorer 2fd2db4afa
Add blinking cursor support
This adds support for blinking the terminal cursor. This can be
controlled either using the configuration file, or using escape
sequences.

The supported control sequences for changing the blinking state are
`CSI Ps SP q` and private mode 12.
2020-11-23 23:11:03 +00:00
Christian Duerr 07cfe8bbba
Add support for '~/' in config imports
This allows the configuration file imports to start with '~/' and
resolve relative to the user's home directory.

There is no support for '~user/' or '$HOME/' or any other shell
expansion. However since paths relative to the home directory should be
sufficient for everything, this provides a very simple solution without
any significant drawbacks.

Fixes #4157.
2020-11-24 00:37:34 +03:00
James Simpson c1f0e83cbb
Ignore nonexistent config imports instead of raising an error
Fixes: #4330.
2020-11-19 17:52:58 +03:00
Christian Duerr 18a226fe45
Fix vi mode terminal reset
Since the vi mode is unrelated to the terminal emulation itself, it
should not be reset during a `reset` to prevent unnecessary confusion.

This also prevents the search from switching from vi mode to vi-less
search without any indication to the user.
2020-11-19 01:15:34 +00:00
Kirill Chibisov 9724418d35
Fix wide characters being cut off
Fixes #791.
2020-11-17 17:49:05 +03:00
Christian Duerr 2bb2ed817b
Bump development version to 0.7.0-dev
This is only an update to the development version and does not represent
a stable release.
2020-11-15 13:38:46 +00:00
Kirill Chibisov 2a16cc5155
Fix zerowidth characters in the last column
This commit fixes the issue that when attempting to write zerowidth
characters into the last column, it is written in the second to last
column instead.

Fixes #4227.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-11-15 00:28:03 +00:00
Christian Duerr 9a78449876
Add ability to select text during search
This removes the restriction of not being able to select text while the
search is active, making it a bit less jarring of a UX when the user
tries to interact with the terminal during search.

Since the selection was used during vi-less search to highlight the
focused match, there is now an option for a focused match color, which
uses the inverted normal match color by default. This focused match is
used for both search modes.

Other mouse interactions are now also possible during search, like
opening URLs or clicking inside of mouse mode applications.
2020-11-13 08:40:09 +03:00
Nathan Lilienthal 4fc35f6038
Spawn new alacritty processes in CWD on macOS
On macOS we can use 'proc_pidinfo' to determine the working
directory of the terminal foreground process.

Fixes #1979.
2020-11-07 04:48:48 +00:00
Christian Duerr 3957a2555d
Deprecate the WinPTY backend 2020-11-06 17:33:02 +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 9028fb451a
Fix visual bell getting stuck
This resolves a problem with the visual bell where it would not
automatically trigger a redraw itself after the initial frame has been
rendered.

Since the unit of the visual bell duration is also unclear, it has been
clarified.
2020-10-30 09:22:13 +03:00
Christian Duerr bede5d5d1c
Fix crash with large negative font offset
Fixes #4363.
2020-10-29 22:14:43 +00:00
Kirill Chibisov f03269cab0
Update dependencies
Fixes #4194.
2020-10-14 19:09:19 +03:00
Taylor Blau 56e0f5bb05
Add support for urgency hints CSI
Teach Alacritty to stop setting the window as urgent upon a bell by
emulating xterm's 'bellIsUrgent' resource and relevant CSI. When this
resource is enabled (with 'CSI ? 1042 h'), a bell event causes the
window to be marked as urgent. When the resource is disabled (with 'CSI
? 1042 l'), the window is not marked urgent in the event of a bell.

There are two wrinkles worth noting here:

  - The 'TermMode::URGENCY_HINTS' does _not_ affect the terminal's
    configured bell command, since we only want to control whether or
    not the window is marked as urgent, not anything else.

  - In xterm, the 'bellIsUrgent' resource is _disabled_ by default.
    Since bouncing the dock icon has been the default in Alacritty on
    macOS thus far, do not make an effort to change that in this patch.

This allows users to emit "\e[?1042l" and disable bouncing the dock
icon.

Fixes #2950.
2020-10-10 21:24:40 +00:00
Kirill Chibisov 860adde457
Fix feature checking in cross builds
Checking for target os in build.rs doesn't work, since build.rs
is running for host, so checking should be done in src. Thus moving
'compile_error!' check from build.rs to main.rs.
2020-10-10 00:25:39 +03:00
Kirill Chibisov 67db9b228d
Bump glutin to 0.25.0
Fixes #4206.
Fixes #4162.
Fixes #4017.
Fixes #3998.
Fixes #3831.
Fixes #3782.
Fixes #3708.
Fixes #2734.
Fixes #2714.
Fixes #1801.
2020-10-07 17:40:50 +03:00
Alessandro Menezes 44a6dba0af
Fix non-ascii message bar text width calculation
When formatting text for display in the message bar, Alacritty was using
the byte length of the text instead of the glyph count. This lead to
unnecessary blank space at the end of lines due to overestimation of
their length.

There also were no extra spaces inserted after fullwidth characters,
leading to Alacritty giving them only a single cell of space. In line
with the rest of Alacritty's rendering, a wide char spacer whitespace is
now inserted in the message bar after glyphs which should occupy two
cells.

Fixes #4250.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-10-04 03:17:36 +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
Kirill Chibisov e9c0034f4d
Fix selection incorrectly expanding when scrolled in history
When doing selection expansion we were checking for wide char flags
on a cells from the bottom of the terminal instead of in a current
viewport when scrolled up in history, which was leading to expanding
more than needed if we had wide chars on the same viewport cell,
but in the bottom of the terminal.

Fixes #4257.
2020-09-26 23:51:31 +00:00
Christian Duerr 085cc35b14
Fix IME position with fullwidth chars in search 2020-09-25 00:21:21 +00:00
Christian Duerr 56d25d1ff8
Add changelog entry for FreeType version bump 2020-09-22 20:42:16 +00:00
Rohan Poojary 1bf40a8cc7
Pass existing CLI parameters to SpawnNewInstance
Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-09-06 15:38:49 +00:00
Mateusz Mikuła 5ee7ae8a27
Disable WinPTY with windows-gnu toolchain
Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-08-31 22:30:45 +00:00
Kirill Chibisov b39c791649
Update smithay-clipboard to 0.5.2
Fixes #4139.
Fixes #4085.
2020-08-30 21:18:01 +03: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 6cfcd7c259
Add CLI parameter to override config options
This uses the facilities added in
3c3e6870de to allow overriding individual
configuration file options dynamically from the CLI using the
--options/-o parameter.

Fixes #1258.
2020-08-22 20:55:27 +00:00
Christian Duerr 3c3e6870de
Add configuration file imports
This adds the ability for users to have multiple configuration files
which all inherit from each other.

The order of imports is chronological, branching out to the deepest
children first and overriding every field with that of the configuration
files that are loaded at a later point in time.

Live config reload watches the directories of all configuration files,
allowing edits in any of them to update Alacritty immediately. While the
imports are live reloaded, a new configuration file watcher will only be
spawned once Alacritty is restarted.

Since this might cause loops which would be very difficult to detect, a
maximum depth is set to limit the recursion possible with nested
configuration files.

Fixes #779.
2020-08-21 18:48:48 +03:00
Christian Duerr 0003f6683f
Fix selection scrolling with message bar visible
This resolves an issue with selection scrolling which would cause the
selection to wrap to the top of the screen once the cursor enters the
padding below the message bar.

Fixes #4120.
2020-08-14 10:26:42 +03:00
Kirill Chibisov 0a1683e84d
Use yellow/red from the config for message bar colors
This commit completes the effort to use config colors for
message bar content by picking red/yellow from user's
colors.normal.{red,yellow} for error/warning messages
instead of fixed colors.

It also removes alacritty_terminal::term::color::RED and
alacritty_terminal::term::color::YELLOW from the alacritty_terminal API,
bumping its version to 0.11.0-dev.

Fixes #4116.
2020-08-13 14:59:35 +03:00
Kirill Chibisov f221108086
Use user's background color for render timer text
Using the user's background color in pair with red should provide better
contrast.
2020-08-13 10:55:11 +00:00
Christian Duerr b904207b19
Add support for double underlines
This adds support for double underlines using the colon separated escape
sequence `CSI 4 : 2 m`.

Alacritty will now also always fallback to the normal underline in case
any of the other underlines like the undercurl are specified. The escape
sequence `CSI 4 : 0 m` can now be used to clear all underlines.

Some terminals support `CSI 21 m` for double underline, but since
Alacritty already uses that as cancel bold which is a little more
consistent, that behavior has not changed. So the colon separated
variant must be used.
2020-08-12 19:05:22 +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 1d00883f10
Fix characters swallowed during search
This resolves a bug where characters get swallowed when pressing them
after pressing backspace before the backspace key is released.
2020-08-09 23:29:58 +00:00
Christian Duerr 4b516c6365
Add ^C binding to cancel search and leave Vi mode
Fixes #4089.
2020-08-10 01:57:55 +03:00
Christian Duerr 576252294d
Add support for colon separated SGR parameters
This implements the colon separated form of SGR 38 and 48.

Fixes #1485.
2020-08-07 22:37:23 +00:00
Christian Duerr 291de2500f
Use tcgetpgrp to get PID for SpawnNewInstance
Fixes #4082.
2020-08-06 00:42:49 +00:00
Joe Wilm 99c34c7ce9
Reduce InstanceData footprint
The InstanceData type in the rendering subsystem was previously 17 f32s
plus one u8 which occupied a total of 72 bytes per instance. This meant
that for every character or background cell drawn, 72 bytes were sent to
the GPU. In the case of a 400x100 cell grid, a total of 2.9MB would be
sent.

This patch reduces InstanceData's size to 36 bytes, a 50% improvement!
Using the above example for comparison, a worst case of 1.44MB would be
transferred.

The motivation for this patch comes from macOS. Once the terminal grid
would reach a certain size, performance experienced a sharp and dramatic
drop (render times would go from ~3ms to ~16ms). I don't want to
speculate too much on the underlying issue, but suffice it to say that
this patch alleviates the problem in my testing.

While the performance impact was most significant on macOS, with
rendering times cut by more than 50% in some cases, this also results in
a measurable performance difference on other systems with high density
grids.

Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-08-05 00:24:51 +00:00
Christian Duerr 8b5787a21e
Fix negative window position
This resolves an issue where negative window positions set in the
configuration file would not place the Alacritty window in the correct
location.

Fixes #4061.
2020-08-02 20:09:53 +00:00
Kirill Chibisov c015b39070 Remove 0.5.0 changelog suffix
This is only an update to the changelog and does not represent a stable
release.
2020-08-01 00:38:28 +00:00
Christian Duerr a2b7c9544b Unify changelog section order
This clarifies the order of subsections in the changelog. All entries
are now defined in the order `Packaging`, `Removed`, `Added`, `Changed`
and `Fixed`.

The sections `Security` and `Deprecated` have been removed. Since
deprecation should always just be a soft deprecation with clear user
warnings, it's not much different from just `Changed`, so that should
make it easier to decide where to put things. The `Security` section is
often not clear enough since a lot of changes might have some form of
security impact depending on interpretation. Since there's unlikely to
be any major security advisories from the Alacritty project, that
section is not particularly useful.

The `Added`, `Changed` and `Fixed` order follows the interest of the
user and the impact on them. This puts the most interesting new features
front and center while allowing to go for a deep dive to see if specific
bugs have been fixed.

The `Removed` section was put last since realistically this should not
affect users. All options should be gradually deprecated and no major
features should just get removed. So most of the time this will just
list deprecated features that are now completely removed, which usually
means there's no impact for users that updated from the last version.
2020-07-31 21:01:36 +00:00
Christian Duerr 6378830469 Fix 0.5.0 changelog 2020-07-31 21:01:36 +00:00
Christian Duerr 57c4ac9145
Remove snap packaging config
Since Alacritty should not be responsible for packaging and the
maintainers of the snap package have not kept it up to date, this
removes its configuration file.
2020-07-30 04:02:16 +00:00
Kirill Chibisov 6c4e45f3a6
Bump minimum supported Rust version to 1.43.0 2020-07-28 13:00:55 +03:00
Christian Duerr bedf5f3004
Invert fixed color cursor if it's close to cell bg
This should reduce the number of times people with fixed cursor colors
run into troubles when existing text is already colored.

Using just the background color as a metric instead of both background
and foreground color should ensure that the cursor still has a clear
shape, since just changing the foreground color for a cursor might be
difficult to see. Always inverting the entire cursor instead of keeping
the fixed foreground color is important to make sure the contrast isn't
messed up.

Fixes #4016.
2020-07-26 01:04:39 +00:00