Commit Graph
234 Commits
Author SHA1 Message Date
Josh Leverette 2dd5f0f45d Handle invalid gotos more gracefully. 2017-01-06 15:00:15 -05:00
Joe Wilm 41f7fae34a Merge pull request #60 from MagaTailor/master
Fix compilation on ARM/AARCH64
2017-01-06 08:31:29 -08:00
Joe Wilm 5f6dedd7d3 Handle EINTR in I/O loop
This fixes an issue where encountering some signals panicked the event
loop thread.

Resolves #76
2017-01-06 08:25:40 -08:00
Rudis Muiznieks c0054d0fe2 Added --title argument to set window title 2017-01-06 09:18:23 -06:00
Taylor Trump cf3e569800 Fix ARM 2017-01-05 15:22:51 +01:00
Taylor Trump fb3a9fa80a Fix ARM 2017-01-05 15:21:24 +01:00
quininer kel 0b157c4e92 Allow key_binding have space 2017-01-05 21:45:46 +08:00
Joe Wilm 693aefcbd7 Draw the screen when Refresh event arrives
cc #53
2017-01-04 19:54:29 -08:00
Joe Wilm 79d13c736e Send correct character sequence with alt key
Resolves #46.
2017-01-02 23:47:56 -08:00
Joe Wilm 1edfef4a32 Have default mouse and key bindings
This improves the situation where the user has not installed the default
configuration file.

Resolves #42.
2017-01-02 20:42:57 -08:00
Joe Wilm edd5dc7da5 Fix scrolling with SGR mode
Resolves #43.
2017-01-02 20:25:28 -08:00
Joe Wilm 06991e6eee Better error message when xclip is not available
Resolves #37.
2017-01-02 20:15:24 -08:00
Joe Wilm a105be82cf Real support for placing config in XDG_CONFIG_HOME
Resolves #35.
2017-01-02 20:05:31 -08:00
Joe Wilm 8630185639 Rework font loading
This work started because we wanted to be able to simply say "monospace"
on Linux and have it give us some sort of font. The config format for
fonts changed to accomodate this new paradigm. As a result, italic and
bold can have different families from the normal (roman) face.

The fontconfig based font resolution probably works a lot better than
the CoreText version at this point. With CoreText, we simply iterate
over fonts and check it they match the requested properties. What's
worse is that the CoreText version requires a valid family. With
fontconfig, it will just provide the closest matching thing and use it
(unless a specific style is requested).
2017-01-02 19:49:38 -08:00
Joe Wilm 7c794ada88 Improve error handling for shader initialization
Shader initialization errors at startup should print a nice message now.
2017-01-01 19:19:15 -08:00
Joe Wilm d4e20a4741 Improve error handling for clipboard actions
Previously, these could have crashed alacritty. Now, they simply print
an error message in Red to stderr. The Red format wrapper was moved to a
central location where both main.rs and the alacritty lib can access it.
2017-01-01 19:09:27 -08:00
Joe Wilm 82bfc41af7 Add support for SGR mouse reporting
According to:
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
2017-01-01 18:28:49 -08:00
Joe Wilm a86dfd1a11 Print nice error messages for font loading errors
Resolves #22.
2016-12-31 20:47:29 -08:00
Joe Wilm 2738969f29 Propagate font rasterizer errors
This allows consumers of the font crate to handle errors instead of the
library panicking.
2016-12-31 20:47:02 -08:00
Joe Wilm 72ff775b23 Improve RenderableCellsIter performance
Also adds a benchmark for cell.reset().
2016-12-29 21:56:49 -05:00
Joe Wilm 26ac1df0b1 Add Default impl for Cell
Just a bit of cleanup.
2016-12-29 21:43:55 -05:00
Joe Wilm a91a3f2dce Fix pty read sometimes not triggering draw
There was a lot of complexity around the threadsafe `Flag` type and
waking up the event loop. The idea was to prevent unnecessary calls to
the glutin window's wakeup_event_loop() method which can be expensive.
This complexity made it difficult to get synchronization between the pty
reader and the render thread correct. Now, the `dirty` flag on the
terminal is also used to prevent spurious wakeups. It is only changed
when the mutex is held, so race conditions associated with that flag
shouldn't happen.
2016-12-29 21:38:22 -05:00
Joe Wilm b704dafb24 Fix some bugs with selections
Moving the window on macOS would cause a panic in certain circumstances.
2016-12-29 20:53:41 -05:00
Joe Wilm 818a2f6161 Add super hacky underline drawing
Using underscores because it's easy. It's also wrong.

cc #11
2016-12-29 16:05:32 -05:00
Joe Wilm d06360216d Hopefully fix read not triggering draw
The terminal mutex is no longer released between event processing and
doing a draw. This may fix the race condition with data arriving but not
being displayed until a subsequent event.

cc #29
2016-12-29 15:34:33 -05:00
Joe Wilm 689e0f4ad7 Unify Cursor, Location and name it Point 2016-12-29 11:09:29 -05:00
Joe Wilm 115a4085b4 Fix selection copy for long lines
Long lines were previously broken at the terminal width. Now, a wrapping
marker is kept on the final cell so that extra newlines are not
inserted.
2016-12-29 10:43:58 -05:00
Joe Wilm 0f1c742857 Minor cleanup in main() 2016-12-27 22:47:25 -05:00
Joe Wilm 8af19c3f0c Fix bug with config reloading
The reloaded config was not used immediately.
2016-12-27 22:46:57 -05:00
Joe Wilm ae470bf68b Implement copying selection for macOS
Still need automatic loading into selection copy buffer for linux.
2016-12-26 22:56:19 -05:00
Joe Wilm d28a734473 Refactor bindings and fix binding tests
The somewhat redundant KeyBinding and MouseBinding types were removed in
favor of a Binding<T> type. This allows all binding code to be reused
for both scenarios.

The binding tests were fixed by only asserting on `is_triggered_by()`
instead of checking that the action escape sequence was delivered
properly.
2016-12-26 19:00:27 -05:00
Joe Wilm 358c9fa17d Major cleanup for event handling
The event handling code grew organically over time, and with that came a
number of warts. The primary issue was with passing some random
selection of arguments to the input::Processor based on what the input
was. There was the issue that if multiple events were drained from a
single PollEventsIterator, the terminal mutex was potentially locked and
unlocked many times. Finally, and perhaps most importantly, there was no
good way to pass necessary state to the Action executor without going
through several API layers.

To fix all that, the input::ActionContext and input::Processor are now
generated once per call to the event::Processor. The input::Processor
holds onto the ActionContext so that it doesn't need to be passed
through layers of function calls. When a binding is activated, the
ActionContext is simply passed to the handler.

This did have the effect of breaking the input::Processor tests
(specifically, those relating to bindings). The issue was not addressed
in this commit since a larger refactor of the bindings is planned which
should also improve testability.
2016-12-26 18:39:30 -05:00
Joe Wilm 3b7c7377c9 Refactor input processing to take action context
Various functions take some permutation of the current selection, the
terminal, and a notifier. Instead of having to juggle some number of
arguments everywhere, the `ActionContext` is constructed and then passed
around.
2016-12-25 18:54:01 -05:00
Joe Wilm 6e708d2119 Implement visual component of mouse selections
This adds the ability to click and drag with the mouse and have the
effect of visually selecting text. The ability to copy the selection
into a clipboard buffer is not yet implemented.
2016-12-22 13:44:13 -05:00
Joe Wilm fd11660c0a Fix config reloading
The main refactor broke config reloading; specifically, colors were not
updating for subsequent draws.
2016-12-16 23:12:44 -08:00
Joe Wilm f32199ae69 Remove dead code 2016-12-16 22:52:38 -08:00
Joe Wilm bde4dacc79 Misc formatting fixes 2016-12-16 22:48:04 -08:00
Joe Wilm 781572096e Remove outdated and no longer correct doc 2016-12-16 22:30:27 -08:00
Joe Wilm dc918ae71a Rustup and clippy
All of the changes in this commit are due to clippy lints.
2016-12-16 22:13:51 -08:00
Joe Wilm 0b3d2dac44 Handle overflow in Term::move_backward
Resolves #25
2016-12-15 09:13:34 -08:00
Joe Wilm 1a1b740c38 Remove need for Rc<RefCell<_>> usage
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-12 09:31:48 -08:00
Joe Wilm 4e9a307bed Fix a couple of compiler warnings 2016-12-12 09:31:29 -08:00
Joe Wilm 4b63bddd55 Track terminal cells on mouse movement
The cell under the cursor is now tracked in the input processor at
`self.mouse.line` and `self.mouse.column`. This could probably be
optimized to only compute the cell when in certain states, but the
calculation is cheap.
2016-12-11 22:02:03 -08:00
Joe Wilm 3d26d3c68a Implement mouse scrolling with line deltas
This makes scrolling work for mouse wheels (was previously just
trackpads).
2016-12-11 20:23:41 -08:00
Joe Wilm 4df29bb377 Finish main.rs cleanup
* config::Monitor is more ergonomic and self-contained
* Fixed an issue with macOS resize. Previously, the terminal was marked
  as dirty in the window resize handler, but the display can't do that.
  Instead, the event processor returns a flag whether it was requested
  to wakeup.
2016-12-11 20:23:41 -08:00
Joe Wilm ed0b1cfff0 Display manages window, renderer, rasterizer
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-12-11 20:23:41 -08:00
Joe Wilm bbd8ddbfc0 Add run() function and document it
The doc comment outlines my plan about cleaning up this function.
2016-12-11 20:23:41 -08:00
Joe Wilm bffe512c33 Add display impl for Points<T> 2016-12-11 20:23:41 -08:00
Joe Wilm 4ba2931437 Cleaning up main; Added window module
Adds a wrapper for the glutin::Window which provides strongly typed
APIs and more convenient interfaces. Moves some gl calls into the
opengl-based renderer.

The point of most of the changes here is to clean up main().
2016-12-11 20:23:41 -08:00
Joe Wilm 093ac43f80 Move config path into Config type
This cleans up the Config::load API significantly. Several miscellaneous
comments were also added.
2016-12-11 20:23:41 -08:00