Commit Graph

1046 Commits

Author SHA1 Message Date
Matthias Krüger 7717bd7c16 Update depend
This fixes an `illegal hardware instruction (core dumped)`
error when building in release mode.
2018-08-05 22:41:37 +00:00
Matthias Krüger 1adb5cb7fc Update dependencies
This fixes an `illegal hardware instruction (core dumped)`
error when building in release mode.
2018-08-05 22:15:11 +00:00
Christian Duerr facab5beef
Reset visible area when RIS is received
When running bash and executing `echo -ne '\033c'`, the terminal should
be cleared. However there was an issue with the visible area not being
cleared, so all the text previously printed would still remain visible.

To fix this, whenever a `reset` call is received now, the complete
visible area is reset to `Cell::default()` (the default Cell) and the
length of the available scrollback history is reset to `0`, which
results in the scrollback history being cleared from the perspective of
the user.

This fixes #1483.
2018-08-03 22:12:23 +00:00
Árni Dagur 23601fbefc Remove "Why doesn't it support scrollback?" from FAQ
Since scrollback is implemented on the scrollback branch,
this section in the FAQ is redundant.
2018-07-29 13:41:32 +00:00
Christian Duerr 24a74d4488
Revert cargo-deb install back to use crates.io
Since `cargo-deb` has been updated on crates.io it is now
possible to just install it from crates.io and build Alacritty's
deb without having to rely on github.
2018-07-29 13:11:19 +00:00
Christian Duerr 5d2faf4365
Enable LTO
This has been disabled temporarily to improve compile times, however
there were some performance regressions caused by this change.

Since this only affects release compiles and performance is a high
priority for Alacritty, LTO has been enabled again.
2018-07-29 11:31:25 +00:00
Christian Duerr 956989998b
Change deb installation from crates.io to git
There have been a number of issues an PRs opened since
the cargo-deb installation does not work with the latest
version from crates.io.

To help out users until the crates.io version is updated,
the installation instructions have been temporarily
changed to install `cargo-deb` through github.
2018-07-29 10:44:50 +00:00
Christian Duerr 7c5585ff25
Merge branch 'master' into scrollback 2018-07-28 23:16:28 +00:00
Christian Duerr c4a0f9c4cb
Merge master into scrollback
* Allow disabling DPI scaling

This makes it possible to disable DPI scaling completely, instead the
the display pixel ration will always be fixed to 1.0.

By default nothing has changed and DPI is still enabled, this just seems
like a better way than running `WINIT_HIDPI_FACTOR=1.0 alacritty` every
time the user wants to start alacritty.

It would be possible to allow specifying any DPR, however I've decided
against this since I'd assume it's a very rare usecase. It's also still
possible to make use of `WINIT_HIDPI_FACTOR` to do this on X11.

Currently this is not updated at runtime using the live config update,
there is not really much of a technical limitation why this woudn't be
possible, however a solution for that issue should be first added in
jwilm/alacritty#1346, once a system is established for changing DPI at
runtime, porting that functionality to this PR should be simple.

* Add working --class and --title CLI parameters

* Reduce Increase-/DecreaseFontSize step to 0.5

Until now the Increase-/DecreaseFontSize keybinds hand a step size of 1.0. Since the font size however is multiplied by two to allow more granular font size control, this lead to the bindings skipping one font size (incrementing/decrementing by +-2).

To fix this the step size of the Increase-/DecreaseFontSize bindings has been reduced to the minimum step size that exists with the current font configuration (0.5). This should allow users to increment and decrement the font size by a single point instead of two.

This also adds a few tests to make sure the methods for increasing/decreasing/resetting font size work properly.

* Add Copy/Cut/Paste keys

This just adds support for the Copy/Cut/Paste keys and sets up
Copy/Paste as alternative defaults for Ctrl+Shift+C/V.

* Move to cargo clippy

Using clippy as a library has been deprecated, instead the `cargo
clippy` command should be used instead. To comply with this change
clippy has been removed from the `Cargo.toml` and is now installed with
cargo when building in CI.

This has also lead to a few new clippy issues to show up, this includes
everything in the `font` subdirectory. This has been fixed and `font`
should now be covered by clippy CI too.

This also upgrades all dependencies, as a result this fixes #1341 and
this fixes #1344.

* Override dynamic_title when --title is specified

* Change green implementation to use the macro

* Ignore mouse input if window is unfocused

* Make compilation of binary a phony target

* Add opensuse zypper install method to readme

* Fix clippy issues

* Update manpage to document all CLI options

The introduction of `--class` has added a flag to the CLI without adding
it to the manpage. This has been fixed by updating the manpage.

This also adds the default values of `--class` and `--title` to the CLI
options.

* Remove unnecessary clippy lint annotations

We moved to "cargo clippy" in 5ba34d4f97 and
removing the clippy lint annotations in `src/lib.rs` does not cause any additional warnings.

This also changes `cargo clippy` to use the flags required for checking integration tests.

* Enable clippy in font/copypasta crates

Enabled clippy in the sub-crates font and copypasta. All issues
that were discovered by this change have also been fixed.

* Remove outdated comment about NixOS

* Replace debug asserts with static_assertions

To check that transmutes will work correctly without having to rely on
error-prone runtime checking, the `static_assertions` crate has been
introduced. This allows comparing the size of types at compile time,
preventing potentially silent breakage.

This fixes #1417.

* Add `cargo deb` build instructions

Updated the `Cargo.toml` file and added a `package.metadata.deb`
subsection to define how to build a debian "deb" install file using
`cargo deb`. This will allow debian/ubuntu users to install `alacritty`
using their system's package manager. It also will make it easier to
provide pre-built binaries for those systems.

Also fixed a stray debug line in the bash autocomplete script that was
writting to a tempfile.

* Add config for unfocused window cursor change

* Add support for cursor shape escape sequence

* Add bright foreground color option

It was requested in jwilm/alacritty#825 that it should be possible to
add an optional bright foreground color.

This is now added to the primary colors structure and allows the user to
set a foreground color for bold normal text. This has no effect unless
the draw_bold_text_with_bright_colors option is also enabled.

If the color is not specified, the bright foreground color will fall
back to the normal foreground color.

This fixes #825.

* Fix clone URL in deb install instructions

* Fix 'cargo-deb' desktop file name

* Remove redundant dependency from deb build

* Switch from deprecated `std::env::home_dir` to `dirs::home_dir`

* Allow specifying modifiers for mouse bindings

* Send newline with NumpadEnter

* Add support for LCD-V pixel mode

* Add binding action for hiding the window

* Switch to rustup clippy component

* Add optional dim foreground color

Add optional color for the dim foreground (`\e[2m;`)
Defaults to 2/3 of the foreground color. (same as other colors).

If a bright color is dimmed, it's displayed as the normal color. The
exception for this is when the bright foreground is dimmed when no
bright foreground color is set. In that case it's treated as a normal
foreground color and dimmed to DimForeground.

To minimize the surprise for the user, the bright and dim colors have
been completely removed from the default configuration file.
Some documentation has also been added to make it clear to users what
these options can be used for.

This fixes #1448.

* Fix clippy lints and run font tests on travis

This fixes some existing clippy issues and runs the `font` tests through travis.

Testing of copypasta crate was omitted due to problens when running on headless travis-ci environment (x11 clipboard would fail).

* Ignore errors when logger can't write to output

The (e)print macro will panic when there is no output available to
write to, however in our scenario where we only log user errors to
stderr, the better choice would be to ignore when writing to stdout or
stderr is not possible.

This changes the (e)print macro to make use of `write` and ignore
any potential errors.

Since (e)println rely on (e)print, this also solves potential failuers
when calling (e)println.

With this change implemented, all of logging, (e)println and (e)print
should never fail even if the stdout/stderr is not available.
2018-07-28 23:10:13 +00:00
Christian Duerr 0ca5c7a695
Fix trailing colors when leaving vim after resize
There is an issue where the terminal would use the template cell to fill
new space after resizing the terminal. However this leads to issues
since the template cell is not always empty and thus can create some
blocks of color appearing out of nowhere.

This should fix this problem by always initializing cells with the
default cell after resizing.
2018-07-26 20:47:33 +00:00
Th3Fanbus b59fd21cac Replace runtime debug assertions with static asserts on scrollback 2018-07-26 15:47:14 +00:00
Christian Duerr 57a455e5f2
Ignore errors when logger can't write to output
The (e)print macro will panic when there is no output available to
write to, however in our scenario where we only log user errors to
stderr, the better choice would be to ignore when writing to stdout or
stderr is not possible.

This changes the (e)print macro to make use of `write` and ignore
any potential errors.

Since (e)println rely on (e)print, this also solves potential failuers
when calling (e)println.

With this change implemented, all of logging, (e)println and (e)print
should never fail even if the stdout/stderr is not available.
2018-07-25 21:05:49 +00:00
Matthias Krüger ddb9a55817 Fix clippy lints and run font tests on travis
This fixes some existing clippy issues and runs the `font` tests through travis.

Testing of copypasta crate was omitted due to problens when running on headless travis-ci environment (x11 clipboard would fail).
2018-07-25 19:46:45 +00:00
Rémi Garde d25134bc6b Add optional dim foreground color
Add optional color for the dim foreground (`\e[2m;`)
Defaults to 2/3 of the foreground color. (same as other colors).

If a bright color is dimmed, it's displayed as the normal color. The
exception for this is when the bright foreground is dimmed when no
bright foreground color is set. In that case it's treated as a normal
foreground color and dimmed to DimForeground.

To minimize the surprise for the user, the bright and dim colors have
been completely removed from the default configuration file.
Some documentation has also been added to make it clear to users what
these options can be used for.

This fixes #1448.
2018-07-23 16:48:27 +00:00
Christian Duerr ea512cb0f3
Switch to rustup clippy component 2018-07-22 00:44:14 +00:00
Josh Leeb-du Toit dbcb5885ad Add binding action for hiding the window 2018-07-22 00:38:53 +00:00
yshui 0d5edb7a7a Add support for LCD-V pixel mode 2018-07-21 18:05:14 +00:00
Aleksandr Pasechnik a6e8974a06 Send newline with NumpadEnter 2018-07-21 17:41:39 +00:00
Christian Duerr 48c0a7b067
Allow specifying modifiers for mouse bindings 2018-07-21 17:37: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
Christian Duerr 5153c20ace
Switch from deprecated `std::env::home_dir` to `dirs::home_dir` 2018-07-20 18:03:37 +00:00
Christian Duerr 512fc61091
Remove redundant dependency from deb build 2018-07-19 16:47:53 +00:00
Christian Duerr 3dabb9783e
Fix 'cargo-deb' desktop file name 2018-07-18 18:39:48 +00:00
zaript 7cc9c11bc9 Fix clone URL in deb install instructions 2018-07-16 16:39:49 +00:00
Christian Duerr 96b3d737a8
Add bright foreground color option
It was requested in jwilm/alacritty#825 that it should be possible to
add an optional bright foreground color.

This is now added to the primary colors structure and allows the user to
set a foreground color for bold normal text. This has no effect unless
the draw_bold_text_with_bright_colors option is also enabled.

If the color is not specified, the bright foreground color will fall
back to the normal foreground color.

This fixes #825.
2018-07-15 19:47:07 +00:00
Anthony Clays 4ae2bc66f2 Add support for cursor shape escape sequence 2018-07-15 16:02:44 +00:00
Patrycja Balik 18f6a7814a Add config for unfocused window cursor change 2018-07-15 13:10:33 +00:00
Micha Gorelick 4928b0ae75 Add `cargo deb` build instructions
Updated the `Cargo.toml` file and added a `package.metadata.deb`
subsection to define how to build a debian "deb" install file using
`cargo deb`. This will allow debian/ubuntu users to install `alacritty`
using their system's package manager. It also will make it easier to
provide pre-built binaries for those systems.

Also fixed a stray debug line in the bash autocomplete script that was
writting to a tempfile.
2018-07-15 13:00:58 +00:00
Joe Wilm b05ad74fe6 Disable scroll buffer for "alt" Grid
The scroll history size for the alternative grid (used by fullscreen
apps such as vim and tmux) is now forced to zero. There are two
motivations for this change:

1. According to the literature, the alt screen should not have scroll
   history.
2. Reduce memory consumption by only allocating the single scroll
   history.

In the future, it may be desirable to support a configuration option to
enable a scroll buffer for the alt screen. By launching without this
feature, we can delay a decision about whether to officially support
this or not.
2018-07-09 10:40:07 -07:00
Christian Duerr cde1d8d1ed Fix incorrect cell side in selection
Previously the cell side of a selection with the mouse outside of the
grid has been calculated by setting the `Side` to `Right` whenever the
`X` of the mouse is bigger or equal to `window_width - padding_x`.
However since the grid doesn't perfectly fit the window in most cases,
there was an additional few pixels where the `Side` would be `Left`,
resulting in the selection jumping around.

To fix this the additional padding due to not perfectly fitting window
size has been included in the calculation. The `X` position is now
checked to be bigger or equal to `width - padding_x - extra_padding_x`.

An important note is that this will need changing when the grid is
centered inside the window, so extra padding is split up evenly. Once
that change is merged the calculation required will be
`width - padding_x - extra_padding_x / 2.`.

This fixes #1412.
2018-07-06 07:30:37 -07:00
Christian Duerr 7433f45ff9
Replace debug asserts with static_assertions
To check that transmutes will work correctly without having to rely on
error-prone runtime checking, the `static_assertions` crate has been
introduced. This allows comparing the size of types at compile time,
preventing potentially silent breakage.

This fixes #1417.
2018-07-05 23:05:33 +00:00
worldofpeace 68b3d8abfd Remove outdated comment about NixOS 2018-07-03 16:35:13 +00:00
Matthias Krüger 21eb50aa50 Enable clippy in font/copypasta crates
Enabled clippy in the sub-crates font and copypasta. All issues
that were discovered by this change have also been fixed.
2018-07-02 22:11:24 +00:00
Christian Duerr 07aaf05f74
Fix scrollback accessing indices out of bounds
There have been two instances of the scrollback trying to access indices
which were moved out of bounds due to new lines (`yes` command). These
have both been fixed.

The first instance was during semantic selection, since the logic of
limiting the selection start point was moved outside of `compute_index`,
it was necessary to add this to semantic selection too. Now semantic
selection, line selection and normal selection should all work without
crashing when new lines are shoving the selection out of bounds.

The other error was with the viewport being outside of the scrollback
history. Since the default is to keep the scrollback buffer at its
current position when new lines are added, it is possible that the
position the scrollback buffer is at is suddenly shoved out of the
visible area. To fix this the `display_offset` is now limited to always
be an allowed value.
If a single line of the viewport is moved out of the history now, the
viewport should move down a single line now, so only valid content is
displayed, with multiple lines this process is repeated.

This fixes #1400.

There was another error where the iterator would attempt to iterate
before the first line in the history buffer, this was because the bounds
of the `prev` iterator weren't setup correctly. The iterator should now
properly iterate from the first cell in the terminal until the last one.

This also fixes #1406, since these semantic selection errors were
partiall related to indexing.
2018-07-02 22:03:04 +00:00
Matthias Krüger 985ba306c7 Remove unnecessary clippy lint annotations
We moved to "cargo clippy" in 5ba34d4f97 and
removing the clippy lint annotations in `src/lib.rs` does not cause any additional warnings.

This also changes `cargo clippy` to use the flags required for checking integration tests.
2018-07-01 20:20:29 +00:00
Christian Duerr 12f952df42
Update manpage to document all CLI options
The introduction of `--class` has added a flag to the CLI without adding
it to the manpage. This has been fixed by updating the manpage.

This also adds the default values of `--class` and `--title` to the CLI
options.
2018-07-01 16:36:15 +00:00
Christian Duerr 12afbd007d
Fix clippy issues 2018-07-01 16:31:46 +00:00
Avindra Goolcharan d5690f6cc7 Add opensuse zypper install method to readme 2018-07-01 14:22:57 +00:00
Craig Furman 015a6d4c03 Make compilation of binary a phony target 2018-06-26 20:35:50 +00:00
Felippe da Motta Raposo caf4580daa Ignore mouse input if window is unfocused 2018-06-23 10:13:19 +00:00
asoderman 128c25ee8b Change green implementation to use the macro 2018-06-19 21:27:47 +00:00
Nathan Lilienthal f55252ec85 Override dynamic_title when --title is specified 2018-06-18 05:26:54 +00:00
Christian Duerr 5ba34d4f97
Move to cargo clippy
Using clippy as a library has been deprecated, instead the `cargo
clippy` command should be used instead. To comply with this change
clippy has been removed from the `Cargo.toml` and is now installed with
cargo when building in CI.

This has also lead to a few new clippy issues to show up, this includes
everything in the `font` subdirectory. This has been fixed and `font`
should now be covered by clippy CI too.

This also upgrades all dependencies, as a result this fixes #1341 and
this fixes #1344.
2018-06-17 09:19:30 +00:00
Christian Duerr bfd62ef45b
Optimize indexing of the grid's raw buffer
The `compute_index` method in the `Storage` struct used to normalize
indices was responsible for a significant amount of the CPU time spent
while running the `alt-screen-random-write` benchmark (~50%).
The issue with this relatively simple method was that due to how often
the method is executed, the modulo operation was too expensive.
Instead of the modulo, a more conservative branch has been put
in place which has a very efficient best-case (which is hit most of the
time).

Until now the methods for growing/shrinking the storage buffer and
compute_index have been written with the assumption that `self.zero`
might be bigger than `self.inner.len()`. However there is no reason why
`self.zero` wouldn't be constrained to always be within the size of the
raw buffer, so this has been changed to make things a little simpler and
more explicit.

Instead of clamping the selection to be within the buffer inside the
storage, this is now checked in the selection logic to remove all
selection-specific logic from `storage.rs`.
2018-06-16 17:50:44 +00:00
Christian Duerr 0f700a01bd
Add Copy/Cut/Paste keys
This just adds support for the Copy/Cut/Paste keys and sets up
Copy/Paste as alternative defaults for Ctrl+Shift+C/V.
2018-06-16 10:11:47 +00:00
Felippe da Motta Raposo 6cbae83f17 Reduce Increase-/DecreaseFontSize step to 0.5
Until now the Increase-/DecreaseFontSize keybinds hand a step size of 1.0. Since the font size however is multiplied by two to allow more granular font size control, this lead to the bindings skipping one font size (incrementing/decrementing by +-2).

To fix this the step size of the Increase-/DecreaseFontSize bindings has been reduced to the minimum step size that exists with the current font configuration (0.5). This should allow users to increment and decrement the font size by a single point instead of two.

This also adds a few tests to make sure the methods for increasing/decreasing/resetting font size work properly.
2018-06-08 23:32:21 +00:00
Tezkerek 66acf1e03d Add working --class and --title CLI parameters 2018-06-07 16:53:16 +00:00
Christian Duerr 93780ef092
Allow disabling DPI scaling
This makes it possible to disable DPI scaling completely, instead the
the display pixel ration will always be fixed to 1.0.

By default nothing has changed and DPI is still enabled, this just seems
like a better way than running `WINIT_HIDPI_FACTOR=1.0 alacritty` every
time the user wants to start alacritty.

It would be possible to allow specifying any DPR, however I've decided
against this since I'd assume it's a very rare usecase. It's also still
possible to make use of `WINIT_HIDPI_FACTOR` to do this on X11.

Currently this is not updated at runtime using the live config update,
there is not really much of a technical limitation why this woudn't be
possible, however a solution for that issue should be first added in
jwilm/alacritty#1346, once a system is established for changing DPI at
runtime, porting that functionality to this PR should be simple.
2018-06-07 15:52:06 +00:00
Christian Duerr 4631ca4db5 Allow changing scrollback history size at runtime
Making use of the changes that have been introduced in #1234 and #1284,
this allows changing the size of the scrollback buffer at runtime.

This simply changes the size of the raw inner buffer making use of the
optimized mutation algorithms introduced in #1284. As a result,
shrinking the scrollback history size at runtime should be basically
free and growing will only introduce a performance cost when there are
no more buffered lines. However, as a result there will not be any
memory freed when shrinking the scrollback history size at runtime.

As discussed in #1234 a potential solution for this could be to truncate
the raw buffer whenever more than X lines are deleted, however this
issue should not be very significant PR and if a solution is desired a
separate issue/PR should be opened.

This fixes #1235.
2018-06-02 10:03:42 -07:00
Joe Wilm 24c50fa0a7 Remove dead code 2018-06-02 09:56:50 -07:00