Commit Graph
366 Commits
Author SHA1 Message Date
Martin Algesten cc3419df2b somewhat DRYer code for font loading 2017-05-31 09:30:54 -07:00
Aaron Hill 0321f3dcfb Implement FocusIn/FocusOut reports (#589)
Implements sending FocusIn/FocusOut events, as defined at
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-FocusIn_FocusOut
2017-05-29 09:51:49 -07:00
Niklas Claesson 81116fb8a4 Add config file as cli option (#576)
* Parse cli arguments before configuration file

Parsing the cli arguments before the configuration file allows `--help`
and `--version` to be used even if the configuration file is broken.

* Add configuration file to command line arguments

This commit adds a new command line flag `--config-file` to override the default
configuration file location. If the specified file is unavailable,
Alacritty will quit instead of generating a fallback. If the specified
file is invalid, i.e. /dev/null, the compiled in defaults will be loaded
instead.
2017-05-28 17:42:36 -07:00
ns b9ec141c92 Find and set $WINDOWID to X11 window ID (#586) 2017-05-27 20:08:28 -07:00
Niklas Claesson e2be3c34b4 Remove incorrect close (#552)
Ownership of the slave file descriptor is passed to the process::Stdio
structs and will be closed when they are dropped. If the slave fd is
closed explicitly then the next fd that is opened during the same scope
will get silently closed by the Stdio structs when they are dropped.
2017-05-27 19:52:58 -07:00
Dominik Miedziński 5977776874 Add support for running commands on key press (#566)
Based on option `command` in key binding section in config, e.g.

    - { key: N,        mods: Control|Shift,    command: alacritty }
    # or
    - {
        key: N,
        mods: Control|Shift,
        command: {
          program: "alacritty",
          args: ["-e", "vttest"],
    }}

specified command will be run in the background on key press. Alacritty
doesn't wait for its result nor block IO.
2017-05-25 09:19:00 -07:00
Joe Wilm 112abf385f Minor cleanup, style fix, dead code removal 2017-05-24 10:56:50 -07:00
Aaron Hill 7eff38d7b7 Add DrainResult enum 2017-05-24 10:56:50 -07:00
Aaron Hill bc8d86f970 Fix typo 2017-05-24 10:56:50 -07:00
Aaron Hill 876dc15152 Ensure that the event loop thread cleanly exits on shutdown
Background:

If a shell process exits with children still alive (typically due to the
`disown` shell builtin), POLLHUP will not be sent to the master PTY file
descriptor. This is due to the fact that the disowned process still has
the slave PTY open as its STDIN, STDOUT, and STDERR.

If a disowned process never reads or writes from its file descriptors
(which is often the case for graphical applications), the event loop
will end up blocking on poll()/select() when not handling user input
received over the mio channel. When Alacritty shuts down and joins on the
event loop thread, there can never be any more input on the mio channel -
the main thread is no longer handling user keystrokes from the window. Unless
a disowned process happens to access its slave PTY file descriptors, the
event loop will never get the chance to deetect that it should exit.

This commit extends the `Msg` enum to include an explicit `Shutdown`
message, which ensures a clean shutdown (e.g. closing the 'recording'
file). This allows the select()/poll() call to remain blocking, instead
of needing to periodically check the shutdown state in between
timed-out calls.

Fixes #339
2017-05-24 10:56:50 -07:00
Martin Algesten 262c70be57 Fix #573. Ensure we don't write 0 bytes to pty
Any action that results in 0 bytes, such as pasting 0 bytes
from the clipboard hangs the terminal (`pbcopy </dev/null`
followed by ctrl-v), hangs the terminal on both macOS and
Linux. This ensures we never send 0 bytes.
2017-05-24 09:10:11 -07:00
Dominik Miedziński 3224847166 Use debug! instead of println! 2017-05-12 08:58:40 -07:00
N-006 ccd3cc8e6a Fix viewport_size.height calculation
Closes #556
2017-05-10 08:09:02 -07:00
Dominik Miedziński 5c6b7dd244 Fix Device Status reports 2017-05-08 08:38:01 -07:00
Dominik Miedziński 08447a220c Add support for Query Device Status 2017-05-07 15:14:22 -07:00
Joe Wilm cbabef36ed Fix bug in SizeInfo::contains_point
Accidentally broke it when refactoring.
2017-05-06 17:37:01 -07:00
Joe Wilm 1d949d72d4 Work around ICE 2017-05-06 12:53:54 -07:00
Tuomas Siipola 9316771f64 Add window padding option
Padding can be configured by using the `padding` field in the config
file, like so:

    padding:
      x: 2
      y: 2

which would result in a 2px padding within each side of the window.
2017-05-06 12:53:54 -07:00
Joe Wilm 149fbaef09 Fix glyph offsets in cell
We previously had a hard-coded value for aligning glyphs within cells.
The font descent is now used, and the offset should be correct by
default.
2017-05-06 12:53:54 -07:00
Joe Wilm f298e0455a Fix bug with tab rendering
Closes #494.
Resolves #529.
Resolves #512.
Resolves #493.
2017-05-01 09:56:42 -07:00
Aaron Williamson f06be732a2 Combine FontOffset and GlyphOffset structs into Delta struct
The two structs are very similar, so there is no reason for them to be
separate. Instead combine them into a single Delta struct, which can be
used to shift a point in a two dimensional plane.
2017-05-01 08:52:22 -07:00
Aaron Williamson 0a1dc56bcf Add glyph offset option to user configuration
Add the ability to move glyphs within their cells on a global basis via
an option in the configuration file.
2017-05-01 08:52:22 -07:00
Aaron Williamson 1277e07671 Remove unnecessary size argument to metrics function
The changes to metric consumption rendered the size argument
unnecessary, remove it.
2017-05-01 08:52:22 -07:00
Aaron Williamson 7fc50f6690 Improve freetype metric usage
The font metrics function was using freetype metrics in an ineffective
way, improve the use of those metrics and remove the now unnecessary
separate default values for font offset in linux.
2017-05-01 08:52:22 -07:00
Joe Wilm 574586045f Support setting _NET_WM_PID in X11 environments
Support is added for setting _NET_WM_PID automatically. This is to
support scripting of the window environment. For example, this makes it
possible to script opening a window with same CWD:

1. Retrieve the current window
2. (new) get PID of window
3. Check if it's Alacritty, find first child (presumably a shell), and
   get the child's cwd.
4. Spawn new instance of terminal with cwd.

Unaddressed in this commit is how this will coexist on a Wayland system.
2017-05-01 08:36:09 -07:00
Joe Wilm 09031decc0 Support insert mode 2017-05-01 08:21:42 -07:00
Joe Wilm 9c557407d6 Add limit check in scroll_up/down_relative 2017-05-01 08:21:42 -07:00
Joe Wilm 7d20d29f37 Implement tab stop manipulation
Adds implementations for TBC (tabulation clear) and HTS (set horizontal
tabstop).
2017-05-01 08:21:42 -07:00
Joe Wilm 44b238bff8 Remove unused limit function 2017-04-20 10:18:05 -07:00
Joe Wilm 346ec09af5 Fix some bugs with resize 2017-04-20 10:13:28 -07:00
Joe Wilm 7df35a30ea Fix issue with back_color_erase
back_color_erase should not set flags like bold, underline, etc.
2017-04-19 20:43:02 -07:00
Joe Wilm faa2dc11e4 Pass scrolling region tests in vttest 2 2017-04-19 20:17:06 -07:00
Joe Wilm 77295e7f9e Partially add DECCOLM support
It's not possible with DECCOLM to temporarily set 80 or 132 column mode
since the function is a toggle between the two. Instead, only the
additional affects are run in order to get closer to passing vttest.

vttest will never be perfect due to the column mode issue.
2017-04-19 09:03:33 -07:00
Joe Wilm 197e910d63 Support DECOM (Origin Mode) 2017-04-18 22:59:24 -07:00
Zach Day 2bcd165a78 Add CLI arg for setting working directory
Resolves #478.
2017-04-18 19:53:31 -07:00
Joe Wilm a3d00f01b1 Fixes for vttest cursor movement screen 1 2017-04-18 19:53:31 -07:00
Joe Wilm a27f166ef9 Implement LF/NL 2017-04-18 19:53:31 -07:00
Roman Shmatov 302ba5adc6 fix tabulation rendering 2017-04-04 09:03:33 -07:00
Joe Wilm 9acd612b23 Better error handling in event loop
Also checks hup first since if the terminal is either not readable or
writable there's nothing for Alacritty to do.

Closes #480.
2017-04-03 21:34:21 -07:00
Lukas Holecek 52c979bc08 Fix hang on exit after child process failed
Quick test (works ~50%) is to press Ctrl+C followed by Ctrl+D.

Reproducible on Arch Linux with OpenGL from NVidia.

Fixes #228
2017-04-03 21:34:06 -07:00
Justin Charette 5b079f6d43 Do not replace $SHELL with --command option
Signed-off-by: Justin Charette <charetjc@gmail.com>
2017-04-03 20:46:08 -07:00
Joe Wilm 79576b6c0b Add better printing for ref test failure
The previous format was extremely difficult for a human to parse.
2017-04-03 20:44:23 -07:00
Joe Wilm a66d19f633 Fix issue with htop rendering incorrectly
Since we're emulating xterm, we need to support back_color_erase. If
this is found to cause any issues, please open a ticket on GitHub.

Resolves #85.
2017-04-03 20:44:23 -07:00
Aaron Hill aa76b29ff7 Handle CSI command J3 (Clear saved lines)
Xterm supports an extension to the CSI command `Erase in Display (ED)`,
under the command number 3. This command is used to clear the scrollback
buffer - e.g. anything not visible on the screen.

Since scrollback is not part of alacritty, the handler for this
command currently does nothing. If at some point scrollback is implemented,
the corresponding `match` arm can be modified to properly handle this.

For an example of a program which uses this command, run the `clear`
command (using ncurses 6.0). In a supported terminal such as
`gnome-terminal`, this will clear anything off of the screen from the
scrollback buffer. Before this change, `alacritty` would generate
an `Unhandled CSI` message.
2017-03-04 15:49:10 -08:00
Aaron Hill d7c0b1115a Handle OSC command '1' (Set Icon Name) 2017-03-03 15:09:29 -08:00
Joe Wilm 119c7d2856 Add support for wide characters 2017-03-02 09:19:01 -08:00
Anders Rasmussen 96a1503040 Update cell to cursor template when adding a tab. 2017-02-27 08:05:11 -08:00
Joe Wilm 31ed5160a0 Change cursor colors config to use text and cursor
This changes the cursor color config to use the `text` and `cursor`
properties instead of the current `foreground` and `background`
properties. The latter names stop making sense when dealing with cursors
like a vertical bar or underscore. In the new system, the block,
underscore, or vertical bar would always take the color of `cursor`, and
the text would take the color of `text` when using a block, or keep its
normal color when using the underscore or vertical bar.

A warning is now emitted on startup when the old form of cursor color
config is used. This will be a hard error in the future.
2017-02-25 07:55:35 -08:00
Anders Rasmussen fef965c121 hide mouse cursor mac os 2017-02-22 21:07:38 -08:00
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