Commit Graph
317 Commits
Author SHA1 Message Date
Mark Andrus Roberts f1ea49b75d Lazily reset start_time in VisualBell's completed method
Fixes #416. Here's what I think is happening: at short `duration`s, the
VisualBell's [`completed` check](https://github.com/jwilm/alacritty/blob/3ce6e1e4b2924b0d432cbb3e62b4bbef88dd38ff/src/term/mod.rs#L377)
is returning `true` before we've actually had a chance to draw the "normal"
background color. I thought about driving this condition off of whether or not
`intensity` returns 0.0, but we may still miss a draw, I think. Perhaps the best
way to tackle this is to let `completed` lazily reset the VisualBell's
`start_time` (something @jwilm asked about when this feature originally landed),
and to only return `true` when the VisualBell's `start_time` is `None`. This
should effectively delay the final draw until after the VisualBell completes.
2017-02-22 20:57:00 -08:00
Tuomas Siipola 604cc6b25e Document hide cursor when typing behaviour 2017-02-22 14:49:29 -08:00
Tuomas Siipola 2d89f79a29 Fix cursor visibility when window lost focus 2017-02-22 14:49:29 -08:00
Tuomas Siipola 3cc27a4d76 Set cursor only when its visibility changes 2017-02-22 14:49:29 -08:00
Tuomas Siipola 7bb49fabfa Add hide cursor when typing option 2017-02-22 14:49:29 -08:00
Anders Rasmussen 3ce6e1e4b2 use an empty cell as template when resizing grids 2017-02-17 08:50:35 -08:00
Joe Wilm 62eb1e2938 Implement workaround for Mesa issue
This addresses the issue where systems running Mesa drivers would be an
order of magnitude slower than other terminals. With this patch,
performance is nearly as good as with proprietary drivers. There is one
caveat where, since the cause of slowness hasn't been removed, there is
less time available for rendering on Mesa systems.

I've benchmarked this on my system (i5-3570 @ 3.4GHz, GTX 680) using
`time find /usr` with the following results:

* ~2.0 seconds average with proprietary driver
* ~2.3 seconds average with Mesa driver

cc #125
2017-02-15 10:03:46 -08:00
Anders Rasmussen c49d4a9365 Add TERM config entry 2017-02-14 08:53:18 -08:00
Joe Wilm 2be3e8fc5b Handle OSC for setting indexed color values
Resolves #26.
2017-02-11 14:18:05 -08:00
Joe Wilm 908ea5543a Move color list to Term struct
The color list needs to be updated by the parser, and this isn't
possible if it's on the config. This change makes sense semantically as
well since it's really part of the terminal state.

This is in preparation for OSC color parsing.
2017-02-11 14:18:05 -08:00
Joe Wilm d2e8a0cd10 Fix issue with cat /dev/urandom 2017-02-11 13:54:37 -08:00
Joe Wilm 7707dcdc5c Print YAML errors using Display
Much nicer error message than with Debug.
2017-02-10 09:40:26 -08:00
Mark Andrus Roberts fbc7b72271 Add visual bell support
This commit adds support for a visual bell. Although the Handler in src/ansi.rs
warns "Hopefully this is never implemented", I wanted to give it a try. A new
config option is added, `visual_bell`, which sets the `duration` and `animation`
function of the visual bell. The default `duration` is 150 ms, and the default
`animation` is `EaseOutExpo`. To disable the visual bell, set its duration to 0.

The visual bell is modeled by VisualBell in src/term/mod.rs. It has a method to
ring the bell, `ring`, and another method, `intensity`. Both return the
"intensity" of the bell, which ramps down from 1.0 to 0.0 at a rate set by
`duration` and `animation`.

Whether or not the Processor waits for events is now configurable in order to
allow for smooth drawing of the visual bell.
2017-02-07 21:12:56 -08:00
Xiaoyu Yin 92e1cec088 Semantic Selection
Fix tests and add line select

Refactor BidirectionalIter to remove if blocks

Allow for cells tagged with WRAPLINE to continue expanding the selection

Reorganize config into structs

Add test coverage that callbacks are called

Cleanup mouse config

- Uses Duration type for ClickHandler::threshold
- Removes `action` property from ClickHandler--this can be added in a
  backwards compatible way later on
- Renames ClickState::DblClick to DoubleClick

fixup! Cleanup mouse config
2017-02-07 21:04:18 -08:00
Joe Wilm 1852707af3 Implement clearing above cursor 2017-02-07 08:08:08 -08:00
Joe Wilm 098eca8d10 Fix zsh tab completion 2017-02-07 08:08:08 -08:00
Anders Rasmussen edc2c7f5b9 Configurable window dimensions
Adds a configuration option `dimensions` which will set initial
window size by columns and lines. Changes to the config file will
require restart.

resolves #370
2017-02-06 20:45:17 -08:00
Tuomas Siipola 9d44526bf9 Render underline on empty cells
This fixes rendering underlines spanning multiple words.
2017-02-06 11:45:09 -08:00
Tuomas Siipola 6cc6086eed Send mouse wheel commands only if they're supported
Fixes #48
2017-02-06 11:43:26 -08:00
Brandur 12cd04fea2 Add "Quit" action to allow exit on a Cmd-W or Cmd-Q
Adds a new "Quit" action and binds it to Cmd-W and Cmd-Q on Mac OS in an
attempt to make Alacritty feel more like a "normal" citizen of the
operating system. Alternatives like Ctrl-D are okay, but I usually want
to leave my shells nested within Tmux open even if I exit my terminal.
It's also largely selfish: I've built up muscle memory over the years
that takes my fingers to Cmd-Q first (and I suspect I'm not the only
one).

The implementation for an exit is copied from `event.rs` which notably
is already tagged with a FIXME. It seems that `tty.rs` contains a
`process_should_exit` system to help handle a `SIGCHLD`, and it's
possible that these two exit implementations should be merged together.
I could probably tackle that as my next project.

As mentioned in #218, Alacritty can't really spawn other windows right
now, so I've tied in Cmd-W as simply another synonym for quitting until
that's implemented.

Fixes #218.
2017-02-05 18:53:51 -08:00
Joe Wilm 82c9235bb1 Fix bug with restore cursor
The saved cursor position could previously end up outside of the grid if
the terminal was resized to be smaller and then calling a restore.
Restore now ensures the cursor line and column are within grid bounds.
2017-02-03 20:01:13 -08:00
Joe Wilm f2f750f9f3 Alacritty now compiles on stable Rust 🎉 2017-02-03 08:11:19 -08:00
Joe Wilm 875167a510 Fix bug introduced with save/restore patch
Switching between main and alt grids should no longer clear the main
grid.
2017-02-02 21:40:38 -08:00
Joe Wilm d0283141b5 Decouple input processing from Term
Should make input processing much more easily tested.
2017-02-02 09:25:08 -08:00
Joe Wilm 40d7c0c434 Implement save/restore cursor position
This passes the vttest for save and restore cursor position. The
implementation was done according to:

    http://www.vt100.net/docs/vt510-rm/DECSC.html

As of yet, there are a few things not supported by the terminal which
should otherwise be saved/restored.

vte was updated for a fix with CSI param parsing
2017-02-02 09:07:00 -08:00
Joe Wilm b27d1266d6 Fix bug with cursor colors and old config
There was no default supplied for Colors.cursor. This caused config
not specifying that property to break. Adding a default should fix that.
2017-01-30 09:45:09 -08:00
jc00ke 9f064001e2 Load the primary clipboard when pasting
Paste & PasteSelection are not quite the same. The former should be
pulling from the main clipboard where the latter does not.
2017-01-30 07:30:46 -08:00
Joe Wilm 6d744abf7b Update to serde 0.9 and serde-yaml 0.6. 2017-01-29 17:29:56 -08:00
Danny Dulai e04584b082 support for inverting the cursor or using colors 2017-01-29 16:06:29 -08:00
Niklas Claesson 019daa8b69 Add support for -e argument 2017-01-28 12:25:57 -08:00
Joe Wilm 08f348ecea Optimize glyph cache access
Loading a glyph from the cache is a very hot operation in the renderer.
The original implementation would first check if a glyph was loaded and
then call `get()` which would have to search a second time. This showed
up as a very slow point in profiles.

This patch addresses glyph cache access in two ways: by using a faster
hasher optimized for small keys (fnv), and by using the entry API for
fetching a cached glyph. The `fnv` hasher is faster than the default and
is very efficient for small keys. Using the entry API on the HashMap
means only 1 lookup instead of two. The entry API has a downside where
the key needs to get cloned on fetches.

Reducing the GlyphKey width to 64-bits helps in both areas. Copying an
8-byte wide type is very cheap and thus limits downside of the entry
API. The small width also helps with the hasher performance.

Over all, this patch reduced typical render times by several hundred
microseconds on a 2013 MacBook Pro with a full screen terminal full of
text.
2017-01-26 08:43:53 -08:00
Niklas Claesson 04c5ad372a Implement argument passing in config
This commit implements the following syntax in the config file:

```yaml
shell:
  program: /bin/bash
  args:
    - --login
    - --norc
```
2017-01-25 08:50:28 -08:00
Kurnevsky Evgeny 1dca5617e2 Use clap as cli parser. 2017-01-24 08:38:38 -08:00
Niklas Claesson 6e51e9e27b Change to process::Command 2017-01-23 21:08:00 -08:00
Joe Wilm e118431d16 Remove debug_print! macros
The logging macros should be used instead.
2017-01-23 09:14:01 -08:00
Joe Wilm ee37dc86ab Return an error from logging::initialize
Logging initialization now shares the same error handling code as the
rest of the `run` function.
2017-01-23 09:14:01 -08:00
Joe Wilm abd3958cb5 Minor formatting fixes 2017-01-23 09:14:01 -08:00
Joe Wilm db5f65637a Changes to Logger logic
The logger implementation will now only show items from Alacritty.
Additionally, the module info is omitted from the log output. If the
origin of a log item must be found, it can easily be grepped for.
2017-01-23 09:14:01 -08:00
Lukas Lueg 64b42cd2f3 Use the log-crate instead of printing to stdout 2017-01-23 09:14:01 -08:00
Steven Fackler 41f99dc4c0 Dynamically generate test harness
This uses the rustc-test crate, a copy of the standard test crate, to
dynamically create tests for each reference test. No need to remember to
update the macro, just add the directory to ref!
2017-01-23 08:59:54 -08:00
Richard Palethorpe 6229477190 ansi: Designate and invoke graphic character sets
Implement the designation of graphic character sets G0-G3 to ASCII or the
Special character and line drawing glyphs. As well as the invokation/selection
of the character sets (shift in, shift out and lock shifting).
2017-01-21 12:09:21 -08:00
Oula Kuuva 77f95f1477 Remove unnecessary feature
Proc_macro has been stable since 1.15.0, attribute no longer needed.
2017-01-18 22:28:46 -08:00
johalun 398e31fa37 Make it run on FreeBSD 2017-01-18 22:28:16 -08:00
Joe Wilm a2cd4b647c Cleanup getpwuid_r wrapper
The wrapper had some transmutes still from an earlier implementation,
and they are not needed now.
2017-01-15 16:39:22 -08:00
Tom Crayford f85cc353a6 make thin stroke rendering configurable
Makes thin stroke rendering for darwin configurable by a new toplevel
key under `font:` in the config file. Defaults to false, has no impact
on non macos.
2017-01-12 21:19:40 -08:00
Michael Brumlow 06d213fbc7 Proposal for line wrap - ^[[7h and ^[[7l (private)
These changes provide support for disabling auto line wrap which is
currently default to on.

'tput rman' will now disable auto line wrap and alacritty will now not
automatically wrap lines.

'tput sman' will now (re)enable auto line wrap and alacritty will now
automatically wrap lines once it reaches the end of the line.

My testing showed this to work the same as gnome-terminal.

I should note that simply having ^[[7h or ^[[7l in a recording does not
enable and disable line wrapping. This is the same behavior as
gnome-terminal and xterm. Those cape codes come through as private
which are not handled yet. I behave this is the correct behavior.
2017-01-11 22:10:48 -08:00
Joe Wilm a7fc46afce Fix bug where event loop could get stuck reading
One symptom of this bug was being unable to send C-c during `cat
/dev/urandom`.

cc #271
2017-01-11 10:33:56 -08:00
Joe Wilm dfb1b3bb5c Add support for setting title from OSC
Resolves #23
Resolves #144
2017-01-11 09:07:31 -08:00
Joe Wilm 6656df1401 Fix last panic with cat /dev/urandom 2017-01-09 23:10:12 -08:00
Michael Brumlow b99fda5214 Fixing panic on cat /dev/urandom
- Checks to make sure lines count coming from the pty are within a proper
range before doing scrolling.

- Sanitizes scroll region when being set.

- Changes panic for unimplemented screen clear to a print statement.

The first two changes ensure scrolling won't crash us. By sanitizing the
region on set we don't have to complicate the scroll code with limits,
mins, or maxes to ensure the scroll operation is within the range.
Checking if the lines is greater than the total region allows us to
simply clear the region and avoid subtracting large numbers from small
ones.
2017-01-10 00:57:49 -06:00