Commit Graph

729 Commits

Author SHA1 Message Date
Rachel K 59b561b440 Better character cell width with FreeType (#1029)
This should fix #1020, #710, and #902
2018-01-21 13:29:57 -08:00
Christian Duerr b396a9a753
Implement `reset_state` of Term struct (#1035)
Up to this point the `reset_state` method of the `Term` struct has been
just a placeholder. This has been changed and all important state has
been reset.

The only state that has not been reset is stuff which is retrieved from
the config and isn't stored as default on the `Term` struct either. From
what I can tell these are all never changed though.

This fixes jwilm/alacritty#1033.

After doing some more testing trying to figure out how to fix that all
glyphs are messed up after doing `cat /dev/urandom`, I was able to
confirm that resetting `Term::cursor` fixes the glyphs and restores
everything to normal.

So this also fixes jwilm/alacritty#804.
2018-01-18 17:27:07 +00:00
Christian Duerr 692cdef9e3 Update lockfile (#1031)
The lockfile has been updated to make clippy work with nightly again.
2018-01-16 12:29:54 -08:00
Christian Duerr 2b5de00241
Spawn alacritty window as invisible
This change initially spawns alacritty as in invisible window, this
makes it possible for the pty to already access data like `window_id`
without having to wait for the window manager to actually open the
window.

Even though `GlWindow::new` is blocking when `with_visibility(true)` is
used, the `window.show` call is not blocking. So calling `GlWindow::new`
and `with_visibility(false)`, then immediately calling `window.show`
will create a window and make it visible instantly.
2018-01-15 16:19:32 +00:00
Christian Duerr 8aa8422bcc
Update lockfile
Clippy failed to build with the latest nightly, so the lockfile has been
updated to allow the nightly builds to work again.
2018-01-11 16:30:52 +00:00
Christian Duerr f6839a8794
Expand key binding config documentation
A link to all variants available as `key` has been added to the key
bindings documentation, to help users with finding the right place
for mapping key codes.
2018-01-10 18:36:34 +00:00
Paul Alvarez 632ef0df7f Make Mac app installation steps idempotent (#1015)
Repeated uses of `cp -r target/release/osx/Alacritty.app
  /Applications/Alacritty.app` will result in copying Alacritty.app to
  `/Applications/Alacritty.app/Alacritty.app`.
2018-01-10 08:54:34 -08:00
Christian Duerr 02953c2812
Fix `ioctl` call failing on 32 bit architecture (#1011) 2018-01-08 22:49:01 +00:00
Niklas Claesson bd9123e7df Fix indexed color setting regression
Commit 2920cbe710 introduced a regression because of a typo in the chunk slice index for the `parse_rgb_color` call.

This fixes this issue by resetting it to the state it was before the faulty commit.
2018-01-08 13:07:30 +00:00
Christian Duerr cc07624e99 Revert #987 behavior on macos (#1007) 2018-01-07 20:46:11 -08:00
Giorgio Gallo c93d2b1a2d Non-bracketed paste support for DOS CRLFs.
When pasting in non-bracketed more, all line endings (including
DOS-style CRLFs) get normalized to a single CR to simulate a keypress of
the <return> key.
2018-01-07 13:11:46 -08:00
Giorgio Gallo bb3da150de Resolves #733.
When pasting in non-bracketed mode, LFs are replaced with CRs.
2018-01-07 13:11:46 -08:00
Christian Duerr b600e40c8f Honour working dir on linux (#987) 2018-01-06 12:12:29 -08:00
Joe Wilm c44f56e56e Fix SGR mouse reporting
There were two bugs fixed in this commit:

1. `sgr_mouse_report` was not always called when `SGR_MOUSE` bit was set
   due to calling `normal_mouse_report` instead of `mouse_report` in the
   scrolling method.
2. SGR reporting was always going off the left mouse button state rather
   than what was appropriate. This affected SGR scroll reporting since
   it only behaves correctly for pressed events (final character 'M').

Resolves #698.
2018-01-06 11:57:38 -08:00
Christian Duerr 2920cbe710
Add clippy check to travis
This commit adds clippy as a required step of the build process. To make
this possible, all existing clippy issues have been resolved.
2018-01-06 01:42:55 +00:00
Christian Duerr 650b5a0cba
Improve ability of alacritty to deal with broken config
Until now alacritty completely refuses to start when the config is broken
in any way. This behavior has been changed so the worst-case is always
that alacritty launches with the default configuration.

When part of the config is broken, alacritty shouldn't instantly try to
recover to the default config, but instead try to use defaults only for
the parts of the config which are broken. This has also been implemented
for most of the fields in the configuration. So it should be possible that
parts are broken, but the rest is still used for the configuration.

This fixes #954.
2018-01-06 00:50:12 +00:00
Christian Duerr 228400a6c2
Prevent font_size_modifier from sinking too low (#994)
This replaces the `font_size_modifier` stored on the `Term` struct with a `font_size` field.

With this change it is not necessary anymore to calculate the new font size from a delta but the current font size is always stored directly on the `Term` struct.

As a result of this it is now possible to increase the font size by more than 127 steps at runtime. It also limits the minimum font size to 1, so issues with the `font_size_modifier` dropping far below font size 1 are resolved with this change.

This fixes #955.
2018-01-05 03:22:58 +00:00
Christian Duerr 7b4ba80bb1 Pass ModifiersState to mouse_moved method too 2018-01-03 11:15:57 -08:00
Christian Duerr f625257fc8 Pass ModifiersState to mouse input as whole
ModifiersState is now passed to the mouse methods in `input.rs` as a
whole instead of just passing the `shift` state. This should make it a
bit easier to do changes in the future.
2018-01-03 11:15:57 -08:00
Christian Duerr f6f5a73528 Always clear selection
It seems like the common consensus is that even in mouse mode, the
selection should be cleared with a normal click.

If there is any reason why this should not be the case, please let me
know.
2018-01-03 11:15:57 -08:00
Christian Duerr 972176adc3 Use default modifier state
The tests were using a manually setup `ModifiersState`, to clean things
up a bit the `ModifiersState::default` method has been used to replace
this.
2018-01-03 11:15:57 -08:00
Christian Duerr 3765598fef Fix failed tests
Three was still a test which passed the whole modifiers struct instead
of just the shift bool, this has been fixed.
2018-01-03 11:15:57 -08:00
Christian Duerr 04bfda943a Update mouse modifiers to only pass shift
The only mouse modifier required right now is the shift key, to prevent
passing around unnecessary state, only the shift state is passed to the
mouse processors now.
2018-01-03 11:15:57 -08:00
Christian Dürr b83a26ffe0 Enable shift+select in mouse mode
When an application takes control over the mouse, it usually disables
selection completely. However the common way to still make selection
possible is by allowing selection while the shift key is held down.

This feature is implemented here by making use of the new `modifiers`
field on mouse events with glutin/winit.

This fixes jwilm/alacritty#146.
2018-01-03 11:15:57 -08:00
Geert Jansen 20aa45c878 Add support for set-clipboard. (#970)
This allows e.g. tmux to set the clipboard via the OSC 52 escape code.
2018-01-02 08:32:50 -08:00
Christian Duerr b01dc062c7 Address feedback
The config documentation has been changed to make it clear which part of
the documentation is related to which setting.

The faux scrollback part of the `scroll_terminal` method has been
cleaned up by making use of the fact that the `codepoint + 1` can be
used in the escape sequence which is used for scrolling.
2018-01-02 08:24:03 -08:00
Christian Dürr 9797bd72bc Allow faux scroll amount configuration
It is now possible to configure the amount of lines
scrolled with faux scrollback.
2018-01-02 08:24:03 -08:00
Christian Dürr aa1f31785e Add config option for faux scrollback
Some people have complained about the behavior of faux scrollback inside
of vim/tmux, however from what I can tell, alacritty behaves the same
way as other terminal emulators that support faux scrollback.

However there are a lot of terminal emulators that do not support faux
scrollback at all, which leads to people complaining about unusual
scroll behavior.

This is my proposal on how to solve this issue, by giving people that do
not like the VTE-Style faux scrolling the option to opt-out.
2018-01-02 08:24:03 -08:00
Joe Wilm 8ce553f28a
Fix zombie children (#976)
Resolves #973
2017-12-29 09:19:14 -08:00
Oliver Uvman 2879830f1d Refactor populate cursor, fix-wide-cursor (#762)
Cleanup cursor handling code and support wide cursors
2017-12-24 13:23:53 -08:00
Dustin caddac918e Change mouse cursor on terminal mode change (#865)
Some terminals have functionality around changing the type of mouse
cursor dynamically (arrow and text) based on which mode(s) the VTE is
in. For example, gnome-terminal changes the cursor from text (default)
to an arrow when opening programs that track mouse events (e.g. vim,
emacs, tmux, htop, etc.). The programs all allow using the mouse
interactively under some circumstances (like executing `set mouse=a` in
vim).

The programs that use an interactive mouse set the terminal mode to
different values. Though they're not entirely the same terminal mode
across programs, an emulator like vte (the library gnome-terminal
implements), changes the mouse cursor if the mouse mode is one of the
following:

- 1000: Mouse Click Tracking
- 1001: Mouse Highlight Tracking
- 1002: Mouse Cell Motion Tracking
- 1003: Mouse All Motion Tracking
- 1004: Mouse Focus Tracking

See 6acfa59dfc/src/vteseq.cc (L708)
for more information.

This commit adds functionality that changes the winit/glutin
`MouseCursor` when a mouse-listening mode of 1000-1004 is set. It
behaves similarly to when the window title changes.
2017-12-24 12:15:42 -08:00
Wesley Gahr ed91eb365e Adding dynamic_title property to configuration (#819)
This logic is applied in Term's ansi::Handler implementation
to avoid unnecessary allocations.
2017-12-24 10:24:28 -08:00
Joe Wilm 4fb2109497 Fix stack overflow with too large glyphs
This resolves the remaining issue of #842.
2017-12-24 10:00:12 -08:00
Christian Dürr 793b5cc3a9 Move custom cursor block on ft
Moved the custom cursor block on ft to the top, so no unnecessary
operations are executed when trying to draw a custom cursor glyph.
2017-12-24 09:46:54 -08:00
Christian Dürr 62d9174509 Use font_key provided with cursor glyphs
Previously it was assumed that the font_key for the normal font is
always 0, because this assumption was a bit of a stretch, now the
font_key provided with the glyph is used. This is always the bold,
italics or normal font associated with the cell.
2017-12-24 09:46:54 -08:00
Christian Duerr 645100cf5f Fix linux symbol size
With linux every box, line or underline should now have the
pixel-perfect size with any font at any size.

This uses the default font to get the size of the monospace box. It
assumes that the face 0 is always the primary font, if this is not the
case, this will probably break.
2017-12-24 09:46:54 -08:00
Theodore Dubois 7895e32083 Remove the launcher and set the locale/current directory in alacritty (#879) 2017-12-24 09:46:54 -08:00
Christian Duerr 6eb634a2b8 Add box cursor to unfocused underline and beam
Because some people have requested this change, the beam and underline
cursors now also transform into an empty box when the terminal loses
focus. Like this there is one unique symbol to indicate that a terminal
is not currently focused.
2017-12-24 09:46:54 -08:00
Christian Duerr 44251d9dbb Refactor darwin code
The ascent calculation on darwin was more complicated than it needed to
be. By running a `.ceil()` instead of adding one, checking if it's 0,
substracting if it is, and then flooring it, a few instructions could be
shaved off.
2017-12-24 09:46:54 -08:00
Christian Duerr fe29b8c687 Add custom box cursor for unfocused window 2017-12-24 09:46:54 -08:00
Christian Duerr 8195d71034 Format cursor code and add documentation
As requested a few comments have been added to the darwin code. There
also was an off by one error in the ascent calculation which has been
corrected.

The beam cursor width has also been tweaked to be slightly slimmer in
general.

All code added in this PR has also been run through the default rustfmt
to make sure the formatting is okay.
2017-12-24 09:46:54 -08:00
Christian Duerr ce8bd1aaf2 Add custom cursors for macos
The macos target now also supports the custom beam and underline
cursors. The only thing left for this is now is testing and making sure
it works with tiny fonts.
2017-12-24 09:46:54 -08:00
Christian Duerr d82c4f02b6 Add custom beam cursor
In issue jwilm/asacritty#31 a few people complained about Beam cursor
being weird with their fonts, so to make all cursors uniform in
alacritty, a custom cursor has been added for the Beam too.

The beam cursor's height is always the full height of the monospace font
glyph bounding box. The width depends on the font size. It is calculated
using the width of the cell and dividing it by two. The block is always
aligned at the far-left of the cell.

The implementation is identical to the one of the underline cursor, but
it has been refactored so the glyphs are created in `lib.rs`, which can
be used by darwin/macos to implement these features too.

A small bug in the underline cursor has also been fixed, until now the
width was just using the width of the unicode character. Now it should
be using the full width of the monospace glyph bounding box with every
font.

Here are some screenshots for the Beam cursor:
![Small](https://u.teknik.io/v1QH3.png)
![Normal](https://u.teknik.io/RTlp2.png)
![Big](https://u.teknik.io/DLu2M.png)
![Huge](https://u.teknik.io/pSAFX.png)
2017-12-24 09:46:54 -08:00
Christian Duerr 9f708146d9 Specify unicode code point explicitly 2017-12-24 09:46:54 -08:00
Christian Duerr 5177e42bca Update comment to reference proper character
The unicode character comment has been updated to correctly reference
the character instead of commenting on the variable that might be that
character.
2017-12-24 09:46:54 -08:00
Christian Duerr 5149dcffbf Revert to old system for macos
Because rendering with macos works differently, the old underline cursor
is used for that. The cursor symbol has also been setup as a constant in
the font project.
2017-12-24 09:46:54 -08:00
Christian Duerr bf72b5a326 Add custom underline cursor
As mentioned in jwilm/alacritty#931, it can be troublesome if a font has
an underline symbol outside of the glyph's bounding box. This can lead
to the underline disappearing at the bottom of the terminal.

As a solution a symbol from the private use area was used as the
character code for the underline symbol. Whenever this symbol is
encountered, instead of rendering it, a custom block is rendered.

In this implementation the block has the full character as width and
sits flush with the bottom of the glyph's bounding box. The height is
half the distance between the baseline and the bottom of the bounding
box.
2017-12-24 09:46:54 -08:00
chetgurevitch 958a32767f Update glutin to v0.11 2017-12-23 21:39:09 -08:00
Chet Gurevitch b10390ede8 Update euclid to v16 2017-12-23 21:39:09 -08:00
Chet Gurevitch 76ca679e89 Update bitflags to v1 2017-12-23 21:39:09 -08:00