Commit Graph

19 Commits

Author SHA1 Message Date
Christian Duerr 4dd70ba3a1
Fix clippy warnings 2021-07-03 03:06:52 +00:00
Christian Duerr 6e1b9d8b25
Replace serde's derive with custom proc macro
This replaces the existing `Deserialize` derive from serde with a
`ConfigDeserialize` derive. The goal of this new proc macro is to allow
a more error-friendly deserialization for the Alacritty configuration
file without having to manage a lot of boilerplate code inside the
configuration modules.

The first part of the derive macro is for struct deserialization. This
takes structs which have `Default` implemented and will only replace
fields which can be successfully deserialized. Otherwise the `log` crate
is used for printing errors. Since this deserialization takes the
default value from the struct instead of the value, it removes the
necessity for creating new types just to implement `Default` on them for
deserialization.

Additionally, the struct deserialization also checks for `Option` values
and makes sure that explicitly specifying `none` as text literal is
allowed for all options.

The other part of the derive macro is responsible for deserializing
enums. While only enums with Unit variants are supported, it will
automatically implement a deserializer for these enums which accepts any
form of capitalization.

Since this custom derive prevents us from using serde's attributes on
fields, some of the attributes have been reimplemented for
`ConfigDeserialize`. These include `#[config(flatten)]`,
`#[config(skip)]` and `#[config(alias = "alias)]`. The flatten attribute
is currently limited to at most one per struct.

Additionally the `#[config(deprecated = "optional message")]` attribute
allows easily defining uniform deprecation messages for fields on
structs.
2020-12-21 02:44:38 +00:00
Kirill Chibisov 8e6a608b2d
Print multiline logs in one write call
Fixes potential split of multiline logs in the multithreaded context
by writing them all at once.
2020-12-10 09:00:54 +03:00
Kirill Chibisov 768f9e2285
Fix stdout log message order
This patch makes sure that the message for the creation of a log file is
always the first entry, before any other log file messages.

Since we initialize our log file dynamically, the message is printed as
soon as something is written to it. By making sure that we always write
to a file first and then try stdout, we can ensure that the log file is
always initialized before ever writing log messages to stdout.
2020-11-19 15:45:13 +00:00
Christian Duerr 8a6fe7e5d0
Add logging for crossfont
This refactors the logging function to clean things up a little bit and
also adds the ability to see log messages for the `crossfont` library.
2020-08-14 21:22:02 +00: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 18cf806a27
Remove gui dependencies from alacritty_terminal
This commit removes font dependency from alacritty_terminal,
so it'll simplify the usage of alacritty_terminal as a library,
since you won't link to system's libraries anymore. It also
moves many alacritty related config options from it.

Fixes #3393.
2020-07-11 20:03:09 +03:00
Christian Duerr 87e5b1aa25
Add automatic scrolling during selection
This adds a new `Scheduler` which allows for staging events to be
processed at a later time.

If there is a selection active and the mouse is above or below the
window, the viewport will now scroll torwards the direction of the
mouse. The amount of lines scrolled depends on the distance of the mouse
to the boundaries used for selection scrolling.

To make it possible to scroll while in fullscreen, the selection
scrolling area includes the padding of the window and is at least 5
pixels high in case there is not enough padding present.
2020-06-18 01:02:56 +00:00
Christian Duerr 7aafbb757d
Remove copyright notice from files
Keeping the license as part of every file bloats up the files
unnecessarily and introduces an additional overhead to the creation of
new modules.

Since cargo already provides excellent dependency management, most of
the code-reuse of Alacritty should occur through Rust's dependency
management instead of copying it source.

If code is copied partially, copying the license from the main license
file should be just as easy as copying from the top of the file and
making some adjustments based on where it is used is likely necessary
anyways.
2020-06-06 21:49:14 +03:00
Christian Duerr f1bf481eb8
Remove env_logger depedency
The env logger has been broken for over a year and is not used by anyone
as far as I know. This removes this option entirely in favor of
Alacritty's built-in logger level selection flags.
2020-05-29 06:22:16 +00:00
Christian Duerr 81ce93574f
Extend style guideline documentation 2020-05-05 22:50:23 +00:00
Christian Duerr 988a846c52
Add seconds and nanoseconds to log output 2020-02-14 10:35:34 +03:00
Christian Duerr 3b8ef3a0c4
Revert "Fix backspace deleting chars when IME is open"
This reverts commit 7f4dce2ee0.

Originally it was assumed that macOS always sends the \x7f on backspace
anyways, however this is not true. It seems like the character on
backspace can change even within the same terminal session, so we need
to have our own binding to reliably set the correct binding.

A solution for #1606 should be implemented in cooperation with winit.
2020-02-10 23:41:48 +00:00
Aleksey Kuznetsov 49380bffd2 Add support for alternate scroll escape
Fixes #2727.
2019-10-15 21:13:58 +02:00
Kirill Chibisov 124e98e94e Fix logged config path separators on Windows
It was discovered that we were logging path with `\\` instead of `\` as
separators on Windows due to use of Debug formatting instead of Display
for paths.
2019-10-14 22:34:54 +02:00
Christian Duerr 729eef0c93
Update to winit/glutin EventLoop 2.0
This takes the latest glutin master to port Alacritty to the EventLoop
2.0 rework.

This changes a big part of the event loop handling by pushing the event
loop in a separate thread from the renderer and running both in
parallel.

Fixes #2796.
Fixes #2694.
Fixes #2643.
Fixes #2625.
Fixes #2618.
Fixes #2601.
Fixes #2564.
Fixes #2456.
Fixes #2438.
Fixes #2334.
Fixes #2254.
Fixes #2217.
Fixes #1789.
Fixes #1750.
Fixes #1125.
2019-10-05 02:29:26 +02:00
Christian Duerr 5d173f6df3
Refactor config parsing files
This is a large refactor of the config parsing structure, attempting to
reduce the size of the file a bit by splitting it up into different
modules with more specific purposes.

This also fixes #2279.
2019-05-10 11:36:16 +00:00
Nathan Lilienthal 34c54e7e0e
Add git hash to version string, and fix crate name (#2397)
This moves `cli` out of `alacritty_terminal` and into `alacritty` where
it belongs, along with the `clap` dependency.
2019-05-03 19:48:25 -04:00
Theodore Dubois dbd8538762 Split alacritty into a separate crates
The crate containing the entry point is called alacritty, and the crate
containing everything else is called alacritty_terminal.
2019-04-28 13:24:58 +00:00