aboutsummaryrefslogtreecommitdiff
path: root/src/tty.rs
AgeCommit message (Collapse)Author
2018-01-08Fix `ioctl` call failing on 32 bit architecture (#1011)Christian Duerr
2018-01-06Add clippy check to travisChristian Duerr
This commit adds clippy as a required step of the build process. To make this possible, all existing clippy issues have been resolved.
2017-12-03clippy: do and don't pass some things by reference as suggested ↵Matthias Krüger
(needless_pass_by_value, needless_borrow).
2017-10-30fix some typos in commentsMartin Lindhe
2017-09-27Use clippy = "*", update, and fix some warnings (#796)Aaron Hill
Because there are so many clippy warnings in the current codebase, this commit removes '#![cfg_attr(feature = "clippy", deny(clippy))]', to make it easier to fix warnings incrementally.
2017-05-27Find and set $WINDOWID to X11 window ID (#586)ns
2017-05-27Remove incorrect close (#552)Niklas Claesson
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-04-18Add CLI arg for setting working directoryZach Day
Resolves #478.
2017-04-03Fix hang on exit after child process failedLukas Holecek
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-03Do not replace $SHELL with --command optionJustin Charette
Signed-off-by: Justin Charette <charetjc@gmail.com>
2017-02-14Add TERM config entryAnders Rasmussen
2017-02-03Alacritty now compiles on stable Rust :tada:Joe Wilm
2017-01-28Add support for -e argumentNiklas Claesson
2017-01-25Implement argument passing in configNiklas Claesson
This commit implements the following syntax in the config file: ```yaml shell: program: /bin/bash args: - --login - --norc ```
2017-01-23Change to process::CommandNiklas Claesson
2017-01-18Make it run on FreeBSDjohalun
2017-01-15Cleanup getpwuid_r wrapperJoe Wilm
The wrapper had some transmutes still from an earlier implementation, and they are not needed now.
2017-01-07Avoid unwrap when determining proper shell to useHonza Pokorny
2017-01-06Add "shell" option to configHonza Pokorny
This allows you to configure the shell to use when alacritty starts. cc: #122
2017-01-05Fix ARMTaylor Trump
2016-12-16Rustup and clippyJoe Wilm
All of the changes in this commit are due to clippy lints.
2016-12-12Remove need for Rc<RefCell<_>> usageJoe Wilm
This adds a trait OnResize and a separate method handle_resize to the display. Instead of having a callback to receive resize events, a list of &mut OnResize are passed to this new method. Doing this allowed the only RefCell usage in the codebase to be removed :).
2016-12-11Display manages window, renderer, rasterizerJoe Wilm
This is part of an ongoing decoupling effort across the codebase and tidying effort in main.rs. Everything to do with showing the window with a grid of characters is now managed by the `Display` type. It owns the window, the font rasterizer, and the renderer. The only info needed from it are dimensions of characters and the window itself for sizing the terminal properly. Additionally, the I/O loop has access to wake it up when new data arrives.
2016-11-19Add support for recording/running ref testsJoe Wilm
Ref tests use a recording of the terminal protocol and a serialization of the grid state to check that the parsing and action handling systems produce the correct result. Ref tests may be recorded by running alacritty with `--ref-test` and closing the terminal by using the window "X" button. At that point, the recording is fully written to disk, and a serialization of important state is recorded. Those files should be moved to an appropriate folder in the `tests/ref/` tree, and the `ref_test!` macro invocation should be updated accordingly. A couple of changes were necessary to make this work: * Ref tests shouldn't create a pty; the pty was refactored out of the `Term` type. * Repeatable lines/cols were needed; on startup, the terminal is resized * by default to 80x24 though that may be changed by passing `--dimensions w h`. * Calculating window size based on desired rows/columns and font metrics required making load_font callable multiple times. * Refactor types into library crate so they may be imported in an integration test. * A whole bunch of types needed symmetric serialization and deserialization. Mostly this was just adding derives, but the custom deserialization of Rgb had to change to a deserialize_with function. This initially adds one ref test as a sanity check, and more will be added in subsequent commits. This initial ref tests just starts the terminal and runs `ll`.
2016-09-25Resolve compiler warningsJoe Wilm
2016-09-24Use evented I/O for the ptyJoe Wilm
This was largely an experiment to see whether writing and reading from a separate thread was causing terminal state corruption as described in https://github.com/jwilm/alacritty/issues/9. Although this doesn't seem to fix that particular issue. Keeping this because it generally seems more correct than reading/writing from separate locations.
2016-06-29Add license headers to source filesJoe Wilm
2016-06-14Add support for macOSJoe Wilm
Alacritty now runs on macOS using CoreText for font rendering. The font rendering subsystems were moved into a separate crate called `font`. The font crate provides a unified (albeit limited) API which wraps CoreText on macOS and FreeType/FontConfig on other platforms. The unified API differed slightly from what the original Rasterizer for freetype implemented, and it was updated accordingly. The cell separation properties (sep_x and sep_y) are now premultiplied into the cell width and height. They were previously passed through as uniforms to the shaders; removing them prevents a lot of redundant work. `libc` has some differences between Linux and macOS. `__errno_location` is not available on macOS, and the `errno` crate was brought in to provide a cross-platform API for dealing with errno. Differences in `openpty` were handled by implementing a macOS specific version. It would be worth investigating a way to unify the implementations at some point. A type mismatch with TIOCSCTTY was resolved with a cast. Differences in libc::passwd struct fields were resolved by using std::mem::uninitialized instead of zeroing the struct ourselves. This has the benefit of being much cleaner. The thread setup had to be changed to support both macOS and Linux. macOS requires that events from the window be handled on the main thread. Failure to do so will prevent the glutin window from even showing up! For this reason, the renderer and parser were moved to their own thread, and the input is received on the main thread. This is essentially reverse the setup prior to this commit. Renderer initialization (and thus font cache initialization) had to be moved to the rendering thread as well since there's no way to make_context(null) with glx on Linux. Trying to just call make_context a second time on the rendering thread had resulted in a panic!.
2016-06-09Fix all trivial compiler warningsJoe Wilm
Of note are the `ansi` and `grid` modules becoming public. There are several bits of unused code in each of these. In the case of `grid`, the unused parts are generally useful, like some indexing implementations. In ansi, there are pieces that will be used once the parser is more complete. In any case, these modules are fairly generic and mostly usable outside of Alacritty. Unused cargo packages were also removed.
2016-06-08Fix shutdown deadlockJoe Wilm
Calling ::std::process::exit() from the SIGCHLD handler would sometimes deadlock some OpenGL internal shutdown procedure. To resolve this, a flag was added that can be checked with `process_should_exit`.
2016-06-06Handle SIGCHLDJoe Wilm
Closes alacritty after joining with child process.
2016-06-02Initial support for Terminal Emulation (woo!)Joe Wilm
This patch introduces basic support for terminal emulation. Basic means commands that don't use paging and are not full screen applications like vim or tmux. Some paging applications are working properly, such as as `git log`. Other pagers work reasonably well as long as the help menu is not accessed. There is now a central Rgb color type which is shared by the renderer, terminal emulation, and the pty parser. The parser no longer owns a Handler. Instead, a mutable reference to a Handler is provided whenever advancing the parser. This resolved some potential ownership issues (eg parser owning the `Term` type would've been unworkable).
2016-05-28Initial ANSI parser implementationJoe Wilm
This is the initial terminal stream parsing implementation for Alacritty. There are currently several TODOs, FIXMEs, and unimplemented! things scattered about still, but what's here is good enough to correctly parse my zsh startup. The `Parser` implementation is largely based on the suck-less _simple terminal_ parser. Because this is Rust and Rust has a fantastic type system, some improvements are possible. First, `Parser` is a struct, and its data is stored internally instead of statically. Second, there's no terminal updates hard-coded into the parser. Instead, `Parser` is generic over a `Handler` type which has methods for all of the actions supported by the parser. Because Parser is generic, it should be possible (with proper inlining) to have equivalent performance to the hard-coded version. In addition to using _simple terminal_ as a reference, there's a doc in Alacritty's repository `docs/ansicode.txt`, a summary of the ANSI terminal protocol, which has been referenced extensively. There's probably a large number escapes we don't handle, and that's ok. There's a lot that aren't necessary for everyday terminal usage. If you feel like something that's not supported should be, feel free to add it. Please try not to become overzealous and adding support for sequences only used by folks trapped in 1988.
2016-05-24Implement tty::new()Joe Wilm
Opens a pty, forks a child process, and execs the shell defined in user's /etc/passwd file. Bytes from the pty are currently just written to Alacritty's stdout as a sanity check that things are hooked up. Thanks to `st` for some guidance on setting this up.