Commit Graph

696 Commits

Author SHA1 Message Date
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
Chet Gurevitch ae533e660f Update glutin to v0.10 2017-12-23 21:39:09 -08:00
Chet Gurevitch 1117bb5fda Update deps 2017-12-23 21:39:09 -08:00
Joe Wilm 3472921c7d Update dependencies
Also fixes warning from gl generator
2017-12-23 12:33:35 -08:00
Dustin ea8cf10b2f Assure that newlines are in selections (#777)
When a selection was made, the last line of the selection did not
include a new line character when the line ending was selected. This
would occur if only one line was selected; if multiple lines were
selected, only the final line did not include a newline.

This commit updates the `string_from_selection` function to attempt to
append a newline character in all places where they are suitable.
Because of the simplification of newline insertion, several trait
implementations were removed.
2017-12-22 21:17:04 -08:00
Joe Wilm 7f7ec0682c Remove debug print 2017-12-22 21:01:23 -08:00
Joe Wilm 79e0ced15d
Fix macOS fallbacks (#956)
The cascade list is now generated from Menlo for all fonts. This doesn't
feel correct to me, but it seems to give the expected behavior on macOS.
One of the problems cited was that certain glyphs like ❯ would not be
rendered with default cascade lists for some fonts.
2017-12-22 17:36:52 -08:00
Joe Wilm 672ea9b050 Remove built crate
This became a support burden for me due to various compile and run time
issues.
2017-12-22 14:25:14 -08:00
Colin King 1b1d1d6c1f Update README.md for current state of macOS
Homebrew Rust will correctly compile `alacritty` now, and the monospace
font is automatically set to `Menlo` at first launch.
2017-12-22 14:09:09 -08:00
Benjamin Hoffmeyer f09b9ce806 Add Void Linux to distrobutions with packages
Void Linux has the alacritty package in the main repository's, so compilation from source isn't needed.
2017-12-22 14:07:45 -08:00
Joe Wilm 856770fed5 Style nits 2017-12-22 14:00:17 -08:00
Christian Duerr 09b78dc80a Adapt pixel-based scrolling behavior
The pixel-based scrolling behavior has been adapted to be as similar to
the line-based one as possible.

I still have not been able to test this. But this should have a decent
chance to at least kinda work.
2017-12-22 14:00:17 -08:00
Christian Dürr 14884deba7 Fix faux scrolling for line-based touchpads
Touchpads which use line-based instead of pixel-based updates send
partial scroll requests, so decimal numbers are important. The current
implementation only really used scroll amounts that are either 1 or -1.

This has been fixed and now the line-based touchpads should have very
smooth scrolling, but the pixel-based approach is still WIP and
completely untested.
2017-12-22 14:00:17 -08:00
Christian Duerr e0993587e7 Implement faux scrolling
This patch implements faux scrolling inside the alternate screen buffer.

Whenever the user scrolls up or down while the alternate screen buffer
is active, instead of actual scrolling three up/down arrow keys are
inserted.
2017-12-22 14:00:17 -08:00
Joe Wilm 41296a555e Share LoadGlyph implementations
Previously there were two separate but intended-to-be-identical
implementations. Now the two implementations simply delegate to a
single, shared method. This should help correctness issues in the
future.
2017-12-22 13:18:08 -08:00
Christian Duerr c9abf571f2 Change LoadGlyph in LoaderApi to match RenderApi 2017-12-22 13:18:08 -08:00
Christian Duerr 32cc53a901 Fix stack-overflow when creating a new atlas
When an atlas is full and the `insert` call fails, a new atlas should be
created. This is the current strategy, however the atlas is put at the
end of the vector, but the `current_atlas` index is set to 0, instead of
the last element. This leads to a recursion where it keeps trying to
insert into the full atlas at position 0 instead of the new at
`atlas.len() - 1`.

With this simple fix a stack-overflow is prevented because the new atlas
is inserted as the first element, which then will be used correctly for
loading new glyphs.

This fixes jwilm/alacritty/issues/842 and might also solve
jwilm/alacritty/issues/914 (I wasn't able to reproduce this with the
latest master).
2017-12-22 13:18:08 -08:00
Joe Wilm 7f944a4d3a Use consistent config deprecation message style 2017-12-22 13:14:47 -08:00
Joe Wilm 06812ccea1 Deprecate config top-level dimensions and padding 2017-12-22 13:14:47 -08:00
Robert Günzler 567d7273fa Update config files 2017-12-22 13:14:47 -08:00
Robert Günzler 3bc9cb7b6d Move dimensions and padding into window section 2017-12-22 13:14:47 -08:00
Robert Günzler a35f4590d5 Add new window section to config
Move/rename borderless into window_config as decorations
2017-12-22 13:14:47 -08:00
Robert Günzler f6e5cae0ba Add borderless option to config files
See 46a1ee72267c0979e980607098ce4ef00a3db1ac
2017-12-22 13:14:47 -08:00
Robert Günzler 16c0e24d8e Add 'borderless' option
Until winit gives us more capabilities in regard to window decorations
this implements a simple switch that renders the window without any
title bar or border
2017-12-22 13:14:47 -08:00
Jon McDuffie 6a1bed0a71 Fix License link at the bottom of the readme (#933) 2017-12-16 22:04:10 -08:00
Andrew De Ponte d0fb4c563f On macOS when launching multiple times focus win (#941)
I dug into this and narrowed the issue down to the macOS app bundle
Info.plist file. So, I spun up a native macOS app real quick and tested
it by launching the binary directly and launching it via the app bundle.
When launching from the command line directly, it created multiple
windows & instances of the app. However, when launching via the app
bundle it behaved as I normally expect a macOS app to behave, that is
when launched multiple times to simply focus the already existing window
and instance.

This informed me that it wasn't something in code as much as it was
something in the app bundle configuration. Hence, I reworked the
Info.plist file based on the one that was created by XCode when I made
the native macOS app and it started behaving as expected.
2017-12-13 13:30:27 -08:00
Theodore Dubois 94caa7667d Remove the launcher and set the locale/current directory in alacritty (#879) 2017-12-13 09:52:36 -08:00
Christian Duerr 9bdac6b50a Add cursor style option (#928)
The default cursor can now be configured through the cursor_style field
of the config. Valid options include Block, Underline, and Beam.

The default can be restored by sending \e[0q as in VTE terminals.

Live config reloading is supported for this parameter.
2017-12-03 13:38:42 -08:00
Matthias Krüger d552d28418 clippy: do and don't pass some things by reference as suggested (needless_pass_by_value, needless_borrow). 2017-12-03 12:50:40 -08:00
Matthias Krüger ed6595543b clippy: use is_empty() instead of len() == 0 (warn(len_zero)). 2017-12-03 12:50:40 -08:00
Matthias Krüger ffac0f5840 clippy: remove unneeded return statement (needless_return). 2017-12-03 12:50:40 -08:00
Matthias Krüger 9e6dd81ad9 clippy: string constants do not need to have static lifetime (const_static_lifetime). 2017-12-03 12:50:40 -08:00
Matthias Krüger b2c7fa7ee9 Cargo.lock: bump clippy from 0.0.164 to 0.0.174. 2017-12-03 12:50:40 -08:00
Matthias Krüger b5571da0f3 clippy: fix if_not_else warning 'breaking' the build. Swap blocks and change to "==". 2017-12-03 12:50:40 -08:00