Commit Graph

17 Commits

Author SHA1 Message Date
Joe Wilm f895c2da30 Add support for application keypad mode
Nothing uses it yet, but it is tracked in the terminal state.
2016-07-04 09:19:48 -07:00
Joe Wilm 8851fa9c42 Fix transpose bug with ansi goto
The line/column were swapped. Strong types are great, but we still have
to be careful at the lowest level before they take effect!
2016-07-04 08:28:14 -07:00
Joe Wilm f8579ff53e Make ansi::Handler methods strongly typed
ansi::Handler methods dealing with lines or columns now accept a `Line`
or `Column` where appropriate instead of ambiguous `i64`.
2016-07-03 21:58:35 -07:00
Joe Wilm 0d5667c699 Remove ansi::DebugHandler
DebugHandler was a helper during initial development of the parser. It's
not used any longer.
2016-07-03 21:14:56 -07:00
Joe Wilm 8a4f14188e Make ansi::TermInfo strongly typed
The rows function has been renamed to lines, and it now returns `Line`.
The cols function correspondingly returns `Column`.
2016-07-03 21:12:43 -07:00
Joe Wilm d304ea9b77 Add config file
Configuration may now be specified in either `$HOME/.alacritty.yml` or
`$HOME/.config/alacritty.yml`. See `alacritty.yml` in the repository
root for an example.

When a configuration file cannot be located, a default configuration is
used.
2016-06-30 09:04:06 -07:00
Joe Wilm c8fd2c090c Add license headers to source files 2016-06-29 20:59:14 -07:00
Joe Wilm 09600a3d40
Fix bug handling ansi mode sequences
The sense of set_mode and unset_mode was inverted. The
TextCursor/ShowCursor mode depended on the incorrect behavior, and that
was fixed as well. TextCursor was renamed to ShowCursor to be perfectly
clear on the intent.
2016-06-23 09:43:55 -07:00
Joe Wilm f5faa40066
Fix a few compiler warnings 2016-06-14 08:26:02 -07:00
Joe Wilm 2395066318
Fix backspace
There's never a count associated with this, and it has been removed from
the Handler method to reflect as much.
2016-06-09 08:37:59 -07:00
Joe Wilm 8566e17860
Fix all trivial compiler warnings
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-09 08:30:55 -07:00
Joe Wilm 8126841ed3
Add support for scrolling regions
It's now possible to move around within Vim without the screen becoming
corrupt!

The ANSI parser now calls a (new) `set_scrolling_region` on the handler
when the DECSTBM CSI is received. In order to provide a sensible default
in case that the sequence doesn't include arguments, a TermInfo trait
was added which currently has methods for inspecting number of rows and
columns. This was added as an additional trait instead of being included
on Handler since they have semantically different purposes. The tests
had to be updated to account for the additional trait bounds.

The utilities module now has a `Rotate` trait which is implemented for
the built-in slice type. This means that slices and anything derefing to
a slice can be rotated. Since VecDeque doesn't support slicing (it's
a circular buffer), the grid rows are now held in a Vec to support
rotation.

For ergomomic access to the grid for scrolling and clearing regions,
additional Index/IndexMut implementations were added to the grid::Row
type.

Finally, a `reset` method was added to `Cell` which properly resets the
state to default (instead of just clearing the char). This supports
region clearing and also fixed a bug where cell backgrounds would remain
after being cleared.
2016-06-08 10:39:49 -07:00
Joe Wilm 781c67f0a0
Parse a few more ansi terminal mode commands 2016-06-07 21:13:08 -07:00
Joe Wilm 263a4e8a2e
Fix escape bytes as input bug in ANSI parser
There were several unrecognized escape codes that have arguments which
were being interpretted as input. Naturally, this caused state to be
corrupt. The escape codes are now handled by throwing away the bytes.
Consider this a TODO for later.
2016-06-06 17:41:03 -07:00
Joe Wilm 6636cf6b9f
Minor updates to terminal handling
Properly handles goto_col and goto_row. Additionally, input wrapping is
handled.

Truecolor specs are now set appropriately.
2016-06-06 15:13:45 -07:00
Joe Wilm 30ec145109
Initial support for Terminal Emulation (woo!)
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-06-02 19:42:28 -07:00
Joe Wilm 70b0423a31
Initial ANSI parser implementation
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-28 22:09:25 -07:00