Commit Graph
820 Commits
Author SHA1 Message Date
Wez Furlong 5dfd03468b config: DRY; use serde defaults for Config 2019-11-22 06:50:39 -08:00
Wez Furlong 1737ca4d80 fix subtraction overflow when creating a new window when tab bar enabled 2019-11-22 04:51:55 +00:00
Wez Furlong e9ec35713c raise ratelimit_output_bytes_per_second
10k was a bit tight for a full-screen vim window, so bump
it up a bit more.
2019-11-21 19:03:46 -08:00
Wez Furlong 824ec691fe revise ratelimit_output_bytes_per_second default
I've found that 10_000/s strikes a reasonable balance between
output speed and the ability to interrupt the output.

Refs: https://github.com/wez/wezterm/issues/65
2019-11-21 18:20:30 -08:00
Wez Furlong 06da330087 add low pri spawn queue
Refs: https://github.com/wez/wezterm/issues/65
2019-11-21 18:20:17 -08:00
Wez Furlong a031b5b9eb improve the rate limiter
when over the budget, this reduces to a trickle of 1 byte per
appropriate sub-second interval.  For example, if the limit is
set to 100 bytes per second, we admit 1 byte every 10ms.

Refs: https://github.com/wez/wezterm/issues/65
Refs: https://github.com/wez/wezterm/pull/67
2019-11-21 14:42:33 -08:00
Wez Furlong a26a94b5bb config: allow specifying NONE or "" for key modifiers
previously, we would raise an error for these, which made it
awkward to eg: bind just F1 to an action.
2019-11-21 10:25:14 -08:00
Wez Furlong ac028da1b6 fix an issue with rate limiting data from the child pty
We need to chunk the data that we read from the child otherwise
we may potentially try to admit more data in a single action
than the ratelimiter will ever allow (eg: if we read 4k of data
and the limit is 100 bytes per second, we can never send that
4k of data in a single write).

Our handling of that situation was not good: we'd panic and kill
the background thread that was reading the data, but the rest
of the app was still running.

This commit upgrades to the most recent rate limiter crate
and performs explicit chunking of the output so that we
behave more sanely.

Refs: https://github.com/wez/wezterm/issues/65
2019-11-21 08:36:16 -08:00
Wez Furlong 371e07838d tab bar: set mouse to arrow when in tab bar 2019-11-21 07:08:31 -08:00
Wez Furlong c6b62d8055 tab bar: default mouse coords outside of view
This helps to prevent a spurious hover styled tab caption being rendered
in some cases.
2019-11-21 00:11:51 -08:00
Wez Furlong ac7a509dbb allow configuring the tab bar
The defaults are pretty neutral.  You can get a little more fancy
with something like this:

```
[colors.tab_bar]
background = "#0b0022"

[colors.tab_bar.active_tab]
bg_color = "#2b2042"
fg_color = "#c0c0c0"

[colors.tab_bar.inactive_tab]
bg_color = "#1b1032"
fg_color = "#808080"

[colors.tab_bar.inactive_tab_hover]
bg_color = "#3b3052"
fg_color = "#909090"
italic = true
```
2019-11-21 00:04:49 -08:00
Wez Furlong d716578735 Add optional basic tab UI at the top of the window
This is a little ghetto feeling because we're just stealing the top
line from the terminal model, rather than rendering anything
particularly native, but it is relatively quick and easy to do,
and helps improve the feel when using wezterm on a chromebook
inside crostini; in that environment, the system doesn't render
any text in the window titlebars (WTF!?) so it is desirable
to show something to help navigate the UI.

The tab bar is off by default for now; we'll definitely want to
add options to configure at least the colors, and perhaps add
a keybinding to toggle it at runtime.

```
enable_tab_bar = true
```

While adding support for the tab bar, I found a couple of little
bugs relating to computing the number of rows and columns; one
was during resize where we'd use the prior size instead of
the current size.  Another was during tab spawning where we'd use
a slightly different calculation to determine the size and end
up raising an error about being confused about the screen size.
2019-11-20 21:57:41 -08:00
Wez Furlong d397976acf fix rendering of the cursor position in the line editor 2019-11-16 13:58:01 -08:00
Wez Furlong 6289c08a4e Adopt CSI u modifier encoding for keypresses
See http://www.leonerd.org.uk/hacks/fixterms/ for the specification.

Refs: https://github.com/wez/wezterm/issues/63
2019-11-16 13:38:03 -08:00
Wez Furlong b79ccb50c4 Add option to swap Backspace and Delete
This defaults to true on macOS

Fixes https://github.com/wez/wezterm/issues/64
2019-11-15 19:52:44 -08:00
Wez Furlong 7323e30be7 try to normalize the shift state in the keymap handling code
We weren't recognizing ctrl+shift+c for example on linux.
2019-11-11 09:11:52 -08:00
Wez Furlong 5370e88520 implement explicit Copy keybinding action
previously we would only ever copy to the clipboard when the selection
was changed.

Now we respect the Copy keypress and have it re-copy the selection
into the clipboard.
2019-11-11 08:54:47 -08:00
Wez Furlong a83851dcca fix warning 2019-11-11 08:41:59 -08:00
Wez Furlong e1069e0a7d linux: allow specifying fallback fonts explicitly
previously, if you had defined a list of fonts, we'd show a todo error
and ignore everything but the first entry on linux.

We now parse the list into a set of fontconfig patterns and compose
them together, giving prefernce to the explicitly listed fonts.
(details in the comments in the code).

This allows color emoji to render for user defined fonts without
forcing the user to muck around in fontconfig config.

Added Noto Color Emoji to the fallback; this is used in our
ssh password prompting UI when available.
2019-11-10 00:13:35 -08:00
Wez Furlong a26cab3833 add wezterm imgcat subcommand to output images to the terminal
This subcommand parses its input and outputs an iTerm2 compatible
img escape sequence (https://iterm2.com/documentation-images.html)

Usage is straightforward:

```
$ wezterm imgcat  assets/windows/terminal.ico --width "10%" --height "10%"
```
2019-11-09 15:50:59 -08:00
Wez Furlong 15a86b77bd replace most tinyfiledialogs usage with our own prompts 2019-11-08 21:11:22 -08:00
Wez Furlong 6da7b3ecd0 internalized password/auth UI for ssh
This is a bit of a large commit because it needed some plumbing:

* Change mux creation to allow deferring associating any domains,
  and to change the default domain later in the lifetime of the
  program
* De-bounce the empty mux detection to allow for transient windows
  during early startup
* Implement a bridge between the termwiz client Surface and the
  frontend gui renderer so that we can render from termwiz to
  the gui.
* Adjust the line editor logic so that the highlight_line method
  can change the length of the output.  This enables replacing
  the input text with placeholders so that we can obscure password
  input
2019-11-08 19:55:12 -08:00
Wez Furlong a9a0f463e6 windows: improve default key bindings
refs https://github.com/wez/wezterm/issues/34

A number of key bindings that used super on macos are also
aliased with bindings that use CTRL+SHIFT for improved
compat with windows.
2019-11-05 22:47:34 -08:00
Wez Furlong 3b93442590 config: add send_composed_key_when_alt_is_pressed option
On macos, allow sending eg: ALT-F as ALT-F rather than the composed
graphics character (ƒ) that is the default for that combination in
the macos IME.

This is controlled by a new config option which defaults to false
so that we have the expected terminal behavior by default.
2019-11-05 22:29:22 -08:00
Wez Furlong eb1bc7f736 allow binding opt + key based on pre-composed key presses
This diff adds some plumbing to track the `raw_key` in the KeyEvent;
this is the key prior to composing or eg: mapping dead keys.

With that field in place, we can teach the termwindow layer to attempt
looking up that key mapping from the user defined key bindings.

If we get a match then we can stop further key processing.
2019-11-05 21:32:23 -08:00
Wez Furlong 1ab438c1e2 improve emoji width calculation
I noticed while scrolling `emoji-test.txt` that some of the combined
emoji sequences rendered very poorly.  This was due to the unicode
width being reported as up to 4 in some cases.

Digging into it, I discovered that the unicode width crate uses a
standard calculation that doesn't take emoji combination sequences
into account (see https://github.com/unicode-rs/unicode-width/issues/4).

This commit takes a dep on the xi-unicode crate as a lightweight way
to gain access to emoji tables and test whether a given grapheme is
part of a combining sequence of emoji.
2019-11-05 08:45:08 -08:00
Wez Furlong e288ecce7c windows: avoid panic when clicking on links
The `open` crate causes us to recurse into our wndproc and re-borrow,
so avoid that and schedule a separate call later.
2019-11-04 08:56:11 -08:00
Wez Furlong cb5e351187 macos: try to set the IME cursor position a bit better
Use the current terminal cursor position as the basis for the position
of the IME.
2019-11-04 00:11:27 -08:00
Wez Furlong ca5db29695 add a fallback font for chinese text on macos
I'm no expert, but this at least allows me to mash the IME
in pinyin mode and see chinese characters.
2019-11-03 22:01:35 -08:00
Wez Furlong 819faa3f85 remove unused get_dpi_scale method 2019-11-03 22:01:35 -08:00
Wez Furlong 155a972425 add missing selection normalize calls
I saw

```
thread 'main' panicked at 'you forgot to normalize a SelectionRange', term/src/selection.rs:94:9
```
2019-11-03 22:01:35 -08:00
Wez Furlong c99e2989ef Fix ctrl-J processing
The front-end was treating both \r and \n as Enter and passing
that through to the terminal.

To verify behavior, pay attention to your termios configuration:

```
$ stty -icrnl
$ od -c
<CTRL-J><CTRL-D>
0000000   \n
0000001
$ od -c
<CTRL-M><CTRL-D><Enter>
0000000   \r  \n
0000002
```

Closes https://github.com/wez/wezterm/issues/56
2019-11-03 22:01:35 -08:00
Wez Furlong f882e01ed4 add some debugging around reading console output 2019-11-02 16:53:51 -07:00
Wez Furlong 047a58a6e9 improve error messages when shaping 2019-11-02 16:43:09 -07:00
Wez Furlong 8da5584a52 add fallback font with replacement character on windows 2019-11-02 16:42:03 -07:00
Wez Furlong 2120b1e2ee fix shift-insert paste on windows
... by filling out the complete mapping between the keycode enums
2019-11-02 13:24:31 -07:00
Wez Furlong a2f2438a73 improve error reporting for font related errors 2019-11-02 09:20:17 -07:00
Wez Furlong d0f2204bdd factor out color conversion to match software renderer 2019-10-29 08:42:38 -07:00
Wez Furlong 7ecee7a5d6 defer calling window.show until after probing/enabling opengl 2019-10-29 08:42:38 -07:00
Wez Furlong 7c844e8924 probably fixup build on windows for executor changes 2019-10-28 21:51:46 -07:00
Wez Furlong a9940ca56f remap Char codes to termwiz input codes
refs: https://github.com/wez/wezterm/issues/53
2019-10-28 14:31:10 -07:00
Wez Furlong c8f39b9adf simplify executor acquisition 2019-10-28 08:16:36 -07:00
Wez Furlong 29e4843517 move away from explicit executor.clone_executor() calls
call the gui_executor() function instead
2019-10-28 08:11:06 -07:00
Wez Furlong 01669266f2 rename SoftwareFrontend to GuiFrontend
It started out as a software only cpu renderer but grew into the
current gui frontend; rename to reflect that.
2019-10-27 23:31:44 -07:00
Wez Furlong 728df5662d move localtab out from old guicommon module 2019-10-27 23:31:44 -07:00
Wez Furlong 8bfd92bbfc move clipboard out from old guicommon module 2019-10-27 23:31:44 -07:00
Wez Furlong 4cb74e68dd remove winit/glutin based frontend 2019-10-27 23:31:44 -07:00
Wez Furlong 4e01dec636 font scaling now also resizes the window for opengl+software frontend 2019-10-27 17:48:02 -07:00
Wez Furlong 91b56abb3a confirmed that the descender emoji thing is macos specific
so let's avoid doing it on linux and windows
2019-10-27 15:20:18 -07:00
Wez Furlong a0f6db85cb tweak color emoji descender handling 2019-10-27 13:44:06 -07:00