Commit Graph

1562 Commits

Author SHA1 Message Date
Joe Wilm b91c90dc34 Update cargo.lock with osx clipboard 2016-10-08 21:03:47 -07:00
Joe Wilm 5ddf525747 Implement copypasta::Load for macos::Clipboard 2016-10-08 20:57:30 -07:00
Joe Wilm 9d491f9f67 Start implementing copypasta, a clipboard library
Currently it only supports x11 via the xclip program, and that only
supports reading the clipboard contents.
2016-10-08 18:42:33 -07:00
Joe Wilm 7e69a070aa Don't write v when pasting on macOS
This is a bit of an experiment to see if simply handling 'v' in the
bindings will work or has any bugs not going through ReceivedCharacter.
The change is necessary though to prevent 'v' from being written in
front of every clipboard paste.
2016-09-27 08:27:39 -07:00
Joe Wilm 077a058cc4 wip
doesn't work on ubuntu 16.04 for some reason
2016-09-26 22:22:28 -07:00
Joe Wilm 89937e7bc5 Clean up event_loop module
The main loop body was originally all written inline. There's now
separate functions for each of the actions the loop handles including
channel events, pty reading, and pty writing. There's also helper
functions on State for managing the write list.

The `EventLoop` and its `State` are returned when joining with the
thread it spawns. This will potentially be helpful once config reloading
is introduced.
2016-09-26 08:28:38 -07:00
Joe Wilm 3f6deb8e2f Refactor EventLoop into event_loop module
This type and its implementations were seriously cluttering main.rs.
2016-09-25 19:49:44 -07:00
Joe Wilm 6a5ac20def Resolve compiler warnings 2016-09-25 19:33:51 -07:00
Joe Wilm 4a679d711f Fix bug with scrolling regions
Linefeeds were triggering scrolls in incorrect situations.

Resolves #9.
2016-09-25 19:26:48 -07:00
Joe Wilm f1499d1d45 Use evented I/O for the pty
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-09-24 17:03:07 -07:00
Joe Wilm be09467d48 Fix some compiler warnings
Also enables debug symbols in release profile by default. Until
Alacritty ships, there's going to be lots of perf analysis which needs
debug symbols.

The PriorityMutex low priority method was never used. Now it's just a
fair mutex.
2016-09-23 10:12:11 -07:00
Joe Wilm cbeec3df5a Add unhandled `execute` log 2016-09-23 09:24:26 -07:00
Joe Wilm 09b1843815 Fix missing `esc_dispatch` log
This was previously logging as an unhandled `execute`.
2016-09-23 09:21:51 -07:00
Joe Wilm ff1ceb523d Fix refresh bug
Terminal output wouldn't reliably refresh the screen. Fix is to only
modify this flag when the terminal lock is held which suggests a larger
refactoring should happen.
2016-09-21 21:05:27 -07:00
Joe Wilm 969b9005f5 Update VTE for OSC string fix 2016-09-19 08:07:34 -07:00
Joe Wilm d12b7336d0 Delete an extra space 2016-09-18 20:11:25 -07:00
Joe Wilm 7dd176fea8 Make use of `unlikely` intrinsic
There's some bounds checks we do that panic if the condition is ever
true.
2016-09-18 18:17:33 -07:00
Joe Wilm b6f7b39c0d Minor fixes
Remove random println and add a missing #[inline]
2016-09-18 18:16:58 -07:00
Joe Wilm c3a383ad5a rustup
Adds a `rustc-version` file which can be used to get the proper
compiler.

    rustup override set $(cat rustc-version)
2016-09-18 18:16:08 -07:00
Joe Wilm 13d2d66b6b Rewrite ansi parser using vte crate
Using the vte crate allows removal of the ansi parser state machine and
enables us to just be concerned with actions described in the protocol.
In addition to making alacritty simpler, this also improves correctness
and performance.
2016-09-18 11:26:00 -07:00
Joe Wilm 0d6d0dc0af Remove extra wait_events()
Allegedly x11 wants you to wait for a refresh event before using the
context, but that doesn't arrive on all platforms (notably macOS).
2016-09-16 17:14:16 -07:00
Joe Wilm 7da9de34d8 Fix crash
There might be a better way to track cursor state such that these checks
aren't necessary.
2016-09-16 17:12:53 -07:00
Joe Wilm c5bc39fe26 Implement delete_chars
Among other issues, this fixes a very vissible issue with typing in the
middle of a shell command.
2016-09-15 08:49:55 -07:00
Joe Wilm 6c9989819b Fix resize not redrawing immediately 2016-09-06 07:43:03 -07:00
Joe Wilm b9f663f99e Update deps and remove printlns 2016-09-05 14:17:23 -07:00
Joe Wilm 3085b0b137 Move rendering back to main thread
This is only like the third time I've made this change. The issue of
having a blank screen at startup is due to x11 event loop + glX
interactions. Not sure what the problem is specifically, but
glXMakecurrent was blocking until the x11 event loop advanced.

The input and rendering are able to live on the same thread while still
removing unnecessary renders due to the
glutin::WindowProxy::wakeup_event_loop() method. The PtyReader just
kicks the event loop when there's something to do; otherwise, the event
loop just waits for something to happen and _doesn't_ draw in free run
mode.
2016-09-01 10:27:04 -07:00
Joe Wilm 0517f376be Eliminate extra renders
Currently has a bug where screen is blank at startup. That aside,
Alacritty uses basically 0 CPU now. The input thread is still separate
from the render thread, but, given the ability to wake the event loop,
it may be possible to merge them again. I'm not sure if that's actually
desirable.

Performance is seemingly unchanged.
2016-08-31 21:16:17 -07:00
Joe Wilm 0a94ccfcca Update serde, glutin
Glutin includes GlContext::clear_current() for linux
2016-08-30 20:58:23 -07:00
Joe Wilm fd755831f2 Separate input handling from rendering
To minimize rendering, the input must be handled in a separate thread.
To see, why, consider the optimal rendering solution: renders are only
necessary when the pty has data that changes the terminal state, OR
there is a window event which changes the graphics state. When not
drawing, the render thread is to remain parked at a condition variable,
and it's not possible to handle input while parked! Thus, we need a
separate thread.

In addition to adding the separate thread, each subsystem thread is now
spawned in a separate function to (hopefully) improve readability.
2016-08-29 19:23:04 -07:00
Joe Wilm 3c5d46c851 Scrolling v2
The previous scrolling + scroll region implementation exhibited display
corruption bugs in several applications including tmux, irssi, htop, and
vim. The new implementation doesn't seem to suffer from any of those
issues.

This implementation is able to `find /usr` on my machine (nearly 600k
lines) in ~2.0 seconds while st is able to do the same in ~2.2 seconds.
Alacritty is officially faster!
2016-08-22 08:37:50 -07:00
Joe Wilm b325afe8d2 Term [unimplemented] prints to stderr in release
Previously these were only printed in debug mode, but they are nice to
have in release to see if something should be called that's not when an
application doesn't behave properly.
2016-08-22 08:34:09 -07:00
Joe Wilm 5dfeb95fcb Term handles LineClearMode::{Left, All} 2016-08-22 08:11:34 -07:00
Joe Wilm e0377f02ac Fix scrolling directions to match ansi doc
This also fixed an issue with reverse index where columns where used
instead of lines.
2016-08-19 20:35:13 -07:00
Joe Wilm 568c7d10f2 Add Origin mode to parser 2016-08-19 20:34:33 -07:00
Joe Wilm 1fe4edf449 Fix bug in input
In applications with a scroll region, newlines were not being properly
added because the scroll region was ignored.
2016-08-19 18:06:33 -07:00
Joe Wilm ad4d704ab3 Fix corruption issue
Fixes an issue where input with the cursor at the bottom-right of the
terminal would cause a crash.
2016-08-19 17:55:44 -07:00
Joe Wilm e3c68fed87 Fix tests
Errors/warnings fixed.
2016-08-14 20:25:15 -07:00
Joe Wilm 8b4b1f8df1 Pin nightly compiler on travis
This will prevent builds from being constantly broken... arbitrary
nightlies are not yet supported.
2016-08-14 20:13:20 -07:00
Joe Wilm a62f9aee65 Support bold/italic font rendering on Linux
The FreeType font Rasterizer API is updated to match the CoreText
Rasterizer. This enabled bold/italic fonts since the rest of the
codebase has already been updated.
2016-08-14 20:08:56 -07:00
Joe Wilm b70394170c Support bold/italic font rendering on macOS
This patch adds support for rendering italic fonts and bold fonts.

The `font` crate has a couple of new paradigms to support this: font
keys and glyph keys. `FontKey` is a lightweight (4 byte) identifier for
a font loaded out of the rasterizer. This replaces `FontDesc` for
rasterizing glyphs from a loaded font. `FontDesc` had the problem that
it contained two strings, and the glyph cache needs to store a copy of
the font key for every loaded glyph. `GlyphKey` is now passed to the
glyph rasterization method instead of a simple `char`. `GlyphKey`
contains information including font, size, and the character.

The rasterizer APIs do not define what happens when loading the same
font from a `FontDesc` more than once. It is assumed that the
application will track the resulting `FontKey` instead of asking the
font to be loaded multiple times.
2016-08-12 19:30:14 -05:00
Joe Wilm 874719580c Add support for CGContextSetFontSmoothingStyle
This enables narrower rendering of glyphs and it tends to look a bit
better. iTerm2 and Terminal both do this.
2016-08-03 19:53:48 -07:00
Joe Wilm 16ed2ddfe9 Fix arrow keys on macOS 2016-08-03 08:21:30 -07:00
Joe Wilm 8b34df7c02 Update Glutin to get Cocoa modifier keys 2016-08-03 08:21:30 -07:00
Joe Wilm 66e7228f41 Input expects modifier keys from Glutin
This is experimental on a separate branch of Glutin. It's intended to
fix the problem of certain key events not being delivered on alt-tab and
breaking the modifier state tracking.
2016-07-30 12:52:53 -07:00
Joe Wilm c687eca3fa Optimizations for `find /usr`
Resetting a cell now takes a template. The template is `memcpy`d onto
the cell being reset. This also solves the problem of `Cell.reset()`
being hardcoded to a particular terminal foreground and background.

Scrolling was refactored to need one less branch. There are now
separate functions for scrolling up/down.

Fixes a bug where the first tabstop would not be displayed properly.

`set_char()` code was merged into the handler `input()` method.
2016-07-29 20:16:13 -07:00
Joe Wilm 3826fa68a0 Fix debug printing in ansi
It was always printing intead of only debug builds.
2016-07-29 20:15:36 -07:00
Joe Wilm 6d4e10e2b9 Add test for input
Added a test while debugging arrow keys, no reason to delete it.
2016-07-29 18:27:45 -07:00
Joe Wilm 90e343b36d Early return in input handling
Don't need to handle modifier keys beyond updating state
2016-07-29 18:27:26 -07:00
Joe Wilm 90d66e63fc Switch to write_all in input handler
Make sure all input bytes get flushed
2016-07-29 18:26:51 -07:00
Joe Wilm 9542279f9d Move debug macros to macros.rs 2016-07-29 18:16:41 -07:00