1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-11 03:27:05 +03:00
Commit Graph

769 Commits

Author SHA1 Message Date
Wez Furlong
fc5c435949 stats: fix .size counters showing up as time counters 2022-01-10 10:36:33 -07:00
Wez Furlong
5d52902b4a invalidate fancy title bar before we potentially error out
This feels slightly more robust in the face of errors

refs: https://github.com/wez/wezterm/issues/1527
2022-01-10 08:31:10 -07:00
Wez Furlong
fe0488420b speculative fix for https://github.com/wez/wezterm/issues/1527
We need to invalidate the elements in the title bar if we reallocate
the quads, otherwise we'll be left with random stuff in the texture
coords.
2022-01-10 08:20:18 -07:00
Wez Furlong
a045cfe092 standardize on SshDomain as the way to configure RemoteSshDomain
refs: https://github.com/wez/wezterm/issues/1456
2022-01-09 19:45:11 -07:00
Wez Furlong
79f7f63064 deps: ordered-float -> 2.10
closes: https://github.com/wez/wezterm/pull/1524
2022-01-09 19:25:48 -07:00
Wez Furlong
3593a288ea ssh: rename use_multiplexer to multiplexing
This puts us in a better position for the future to be able
to configure whether we use wezterm, tmux or no multiplexing.

Today we allow wezterm or no multiplexing.

Add docs on this new setting.

refs: https://github.com/wez/wezterm/issues/1456
2022-01-09 19:16:54 -07:00
Wez Furlong
f84c0632d8 gui: allow wezterm connect sshdomnomux
If an ssh domain is set to use_multiplexer=false, it is now
possible to `wezterm connect` to it.

Previously, it was only possible to connect to domains that
used the mux client.

refs: https://github.com/wez/wezterm/issues/1456
2022-01-09 15:52:40 -07:00
Wez Furlong
0676eed42f gui: refactor common code between ssh/connect/start subcommands 2022-01-09 15:25:00 -07:00
Wez Furlong
524663e9ce gui: refactor connect/ssh subcommands to share more code 2022-01-09 14:41:43 -07:00
Wez Furlong
59be1bf8ac wezterm ssh and wezterm serial: now support --class
Notice these were missing when compared to the other gui subcommands.
2022-01-09 13:18:08 -07:00
Wez Furlong
f69177b022 ssh: allow setting SshDomain::use_multiplexer = false
Currently has no effect.

refs: #1456
2022-01-09 13:13:54 -07:00
Wez Furlong
380a67dd85 gui: tidy up whether we use existing gui or publish as a new one
If we decide we want re-use and existing gui due to config differences
we shouldn't then publish the new, differently configured, gui as
the canonical path for that display/class.

Clarify the message that we print when re-using an existing gui
in case someone doesn't want that behavior.
2022-01-09 11:18:47 -07:00
Wez Furlong
627001762e rename dead_key_is_active -> composition_status, dead_key_cursor -> compose_cursor
Since the composition state isn't strictly tied to dead keys, use
a name that better reflects that.
2022-01-09 08:39:21 -07:00
Wez Furlong
71bfa38cf4 input: don't scroll to bottom on key up events
refs: #1483
2022-01-08 15:37:15 -07:00
Wez Furlong
b2ee6793f9 Add default_domain option
When set, changes the default domain to the domain with the specified
name, which potentially affects the default program.

eg: default_domain = "WSL:Ubuntu-18.04" will cause the initial tab
to be spawned via WSL.
2022-01-08 15:05:05 -07:00
Wez Furlong
cdf3fc89f7 launcher: remove WSL items from list
These are now redundant with the list of wsl_domains.

The `add_wsl_distributions_to_launch_menu` option has been removed.
2022-01-08 15:05:05 -07:00
Wez Furlong
0e9924e585 new: WslDomain, a variant on the local domain
The idea is that we want to be able to spawn into wsl with the
convenience of a local domain, but without the awkwardness of
it having a different filesystem namespace.

It would also be great to be able to spawn a new tab or pane
in the same domain and pick up the cwd of the existing one.

The WslDomain allows the user to explicitly list WslDomains
and control eg: default shell, username and so on, but wezterm
will pre-fill a default list of domains based on the `wsl -l`
output that we were already using in the launcher menu.

The existing LocalDomain has been augmented to understand that
it may need to fixup a command invocation and that gives it
the opportunity to rewrite the command so that we can launch
it via `wsl.exe` and pass down the cwd and so on.

This same technique might be extensible to eg: docker instances
in the future.

This commit:

* Introduces `wsl_domains` config and its default list of wsl
  distributions
* Creates LocalDomain instances from that list
* The launcher menu allows spawning a new tab via one of those domains
2022-01-08 15:05:05 -07:00
Wez Furlong
7a824a2594 client: remove race condition in cli shutdown
The client machinery would try to spawn an async attempt at
detaching the unixdomain from the mux on shutdown, but since
we're in the middle of tearing down the scoped executor,
we could sometimes panic.

The client we have in this situation isn't actually associated
with a domain, so we don't need to detach in that situation.

Formalize that by making it an Option, and address the
fanout.
2022-01-07 17:51:10 -07:00
Wez Furlong
e8995c5370 wezterm-gui start now prefers to run via existing gui instance
Using the new publish/discovery stuff from the past couple of commits,
if we can find a matching socket path for a running gui, and the
configuration is likely a match, then use the mux protocol to talk
to the already running gui and ask it to spawn the equivalent program
into the same process.

refs: https://github.com/wez/wezterm/discussions/1486
2022-01-07 17:12:35 -07:00
Wez Furlong
33dd3f393c fix leader key deactivating on key up
refs: https://github.com/wez/wezterm/issues/1520
refs: #1483
2022-01-07 14:10:27 -07:00
Wez Furlong
78c4c56425 input: fix KeyCode::Physical -> termwiz KeyCode conversion
refs: https://github.com/wez/wezterm/issues/1519
refs: #1483
2022-01-07 14:01:01 -07:00
Wez Furlong
4524abcdba gui: revise win32-input-mode flow
We need 100% of the info for it to work correctly, so this commit:

* Exposes the keyboard encoding mode via the Pane trait
* Adds the scan code to the RawKeyEvent
* Has the GUI perform the encoding if the keyboard is set that way
* Removes the basic encoder from termwiz in favor of the gui level one

The net result is that we bypass the Pane::key_up/Pane::key_down methods
in almost all cases when the encoding mode is set to win32-input-mode.

There is now a config option: allow_win32_input_mode that can be
used to prevent using this mode.

refs: #1509
2022-01-07 13:02:09 -07:00
Wez Furlong
3c6bc2c366 add ActivatePaneByIndex key assignment action
refs: #1517
2022-01-07 07:30:17 -07:00
Wez Furlong
17a9d6159a wezterm cli now prefers to talk to main GUI instance
When spawned with no WEZTERM_UNIX_SOCKET environment set,
we now prefer to resolve the gui instance, falling back to
the mux if it doesn't look like the gui is running.

`wezterm cli --prefer-mux` will use the original behavior of
trying to resolve the path from the unix domain in the config.
2022-01-06 22:31:42 -07:00
Wez Furlong
eddf1c031a refactor: move gui socket list from update module to discovery module 2022-01-06 21:55:16 -07:00
Wez Furlong
91fc705e26 gui/client: add stubs for publishing a main gui instance sock path
This will help to route things through a main gui instance per desktop
session/class.

Currently has stubs for windows.
2022-01-06 20:07:46 -07:00
Wez Furlong
27d452a20f input: route key up events to pane on win32
refs: https://github.com/wez/wezterm/issues/1509
2022-01-06 09:45:51 -07:00
Wez Furlong
763c4d7f7e term: reintroduce possibility of key_up events
Nothing generates them right now, and the mux client has no
way to represent them on the wire.

I'm considering constraining them to just win32 for now.

refs: https://github.com/wez/wezterm/issues/1509
2022-01-06 09:45:51 -07:00
Wez Furlong
8437d787b8 ls-fonts --text used wrong per-glyph text
It was showing the whole text for the cluster for each shaped
glyph.

Fix it up to map back to the corresponding cell range and
extract the text from the line.

Include the x_advance metric in the output while we're in
there.

refs: https://github.com/wez/wezterm/issues/1333
2022-01-05 23:36:33 -07:00
Wez Furlong
9f6f901f5b launcher: unbreak filtered view
I refactored and accidentally used entries instead of filtered_entries
2022-01-05 19:56:14 -07:00
Wez Furlong
59f5b849c5 gui: treat IME composition region as a giant stretched cursor
That way we get consistent styling for the span of the composing text
2022-01-05 10:52:33 -07:00
Wez Furlong
b05cb1241e force clusters to break around cursor boundary
When rendering the IME composing text, I noticed that for the Korean
input sequence: shift+'ㅅ' followed by 'ㅏ' we'd render the 'ㅆ' (the
shifted first character) in black and the composing 'ㅏ' in white
against the cursor color, and that was very difficult to read,
especially at the default font size.

To resolve this, this commit:

* Forces clustering to break around the cursor boundary, so that
  we treat the cursor position as its own separately styled cluster
* Adjusts cursor/bg rendering so that we always consider the start of
  the cluster for the colors of that run.  We are guaranteed that a
  ligatured sequence will fit in the background area anyway.

This has the effect of "breaking" programming ligatures such as '->'
when cursoring through them, and decomposing them into their individual
'-' and '>' glyphs, which is a reasonable price to pay for being able
to see things better on screen.

refs: https://github.com/wez/wezterm/issues/1504
refs: https://github.com/wez/wezterm/issues/478
2022-01-05 09:20:11 -07:00
Wez Furlong
0d6fbc1aa2 macos: improve ime vs dead key composing
When we translate a dead key, send the composed event immediately
and don't try to route the current key press via the IME.

Improve rendering when in the composing state: overlay the composing
text at the cursor position to show what the composing text would
look like, even though it hasn't been committed to the input stream
yet.

refs: https://github.com/wez/wezterm/issues/1504
2022-01-05 07:50:12 -07:00
Wez Furlong
71dae34b75 macos: improve IME handling
For Korean text input, pressing SHIFT and then typing in certain
keys begins a composition sequence.  Our logic for when to route
via the IME got so distracted by ALT that it didn't consider SHIFT
and didn't send this sequence to the IME, so we'd fail to compose
those sequences.

While poking at this, I realized that we should treat this composition
similarly to dead keys, in that we can signal the term window to
highlight the cursor color and report that status.

There's some further work to do: the composing text should be rendered
by us.  So far our IME integration assumes that the IME itself will
render over the top of our window, but for this particular input
it doesn't do that.

refs: https://github.com/wez/wezterm/issues/1504
2022-01-04 22:51:49 -07:00
Wez Furlong
6d72101879 launcher: restore j/k movement by default
You now press `/` to enter search mode
2022-01-04 20:49:21 -07:00
Wez Furlong
621dcd3b30 launcher: don't fall off bottom of launcher when filtered 2022-01-04 20:49:21 -07:00
Wez Furlong
6927faebfb launcher: refactor and simplify 2022-01-04 20:49:21 -07:00
Autumn Lamonte
c10ff1e41f fix nits 2022-01-04 19:49:06 -08:00
Autumn Lamonte
07a2acb840 #1457 refactor, ClickPosition 2022-01-04 19:49:06 -08:00
Autumn Lamonte
81f4bbd4aa #1457 Initial commit compiles but doesn't yet work 2022-01-04 19:49:06 -08:00
Wez Furlong
1f6e4497e0 launcher: simplify logic
Remove the local awareness of how to spawn into a window and replace
it with using a KeyAssignment to do that instead.

refs: #1485
2022-01-04 09:49:32 -07:00
Wez Furlong
541701d822 refactor tab navigator into launcher menu
The same core code is used to render both the tab navigator
and the launcher.  The context is specified using some flags
so that you don't get an unholy mess in both places.

The net result of this is that the tab navigator now supports
fuzzy matching.

refs: #664
refs: 1485
2022-01-04 09:35:07 -07:00
Wez Furlong
142f3c7d81 launcher now has fuzzy matching
Just start typing text to build up the fuzzy matching term.
The list of items updates to match the results.

refs: #664
refs: #1485
2022-01-04 08:45:15 -07:00
Wez Furlong
68fb416b34 launcher: fix subtraction overflow for tall windows 2022-01-04 08:05:31 -07:00
Wez Furlong
99f94f8425 launcher overlay: fix build on windows 2022-01-04 08:01:37 -07:00
Wez Furlong
9919745d4e launcher: tidy up key/mod display impl to make it look nicer
Make things a little more compact and display friendly

refs: #1485
2022-01-03 23:38:36 -07:00
Wez Furlong
05ec80d945 gui: dedup and sort key assignment launcher entries
refs: #1485
2022-01-03 23:28:37 -07:00
Wez Furlong
509122c152 Improve launcher menu
* Allow selecting the first few rows by number
* Allow scrolling through long lists of items
* Add actions from key assignments to list

refs: #1485
refs: #1413
2022-01-03 23:07:54 -07:00
Wez Furlong
f002b16ee1 refactor launcher entries to make it easier to build command palette
refs: #1485
2022-01-03 18:27:58 -07:00
Wez Furlong
ad96d84745 fonts: remove descender adjustment
It seems like we don't need this any more; things look better
without it.

refs: #1203
refs: #1499
2022-01-03 14:52:19 -07:00
Wez Furlong
cc507951d0 gui: fix new tab hover colors
refs: #1498
2022-01-03 12:52:58 -07:00
Wez Furlong
34dd0b6688 add mapping from phys to keycode, tidy up windows event processing
refs: #1483
2022-01-03 10:56:32 -07:00
Wez Furlong
5f26746286 window/gui: remove raw/phys fallback fields from KeyEvent
Since we now have RawKeyEvent and a sane way to indicate handling,
we don't need these any more, and it simplifies key dispatch to
remove them.

refs: #1483
2022-01-03 09:13:55 -07:00
Wez Furlong
0224f65fed gui: avoid glitchy live resize
Pass down whether we are in a live resize to the gui layer, so that
we don't incorrectly assume that the scale has changed, and fight
with the window manager.

Built this on my mac: will need to fixup for windows and linux.

refs: https://github.com/wez/wezterm/issues/1491
2022-01-03 08:29:05 -07:00
Wez Furlong
028026049d add window:dead_key_is_active window:leader_is_active
This commit adds a couple of helper methods that provide insight into
the state of the keyboard layer.

The intent is for users to add status information about the keyboard
state.

This commit also ensures that we schedule an update when the leader
key duration expires, and ensures that we close out the leader state
for an invalid key press.

refs: #686
closes: #688

```lua
local wezterm = require 'wezterm';

wezterm.on("update-right-status", function(window, pane)
  local leader = ""
  if window:leader_is_active() then
    leader = "LEADER"
  end
  local dead = ""
  if window:dead_key_active() then
    dead = "DEAD"
  end
  window:set_right_status(leader .. " " .. dead)
end);

return {
  leader = { key="a", mods="CTRL" },
  colors = {
    dead_key_cursor = "orange",
  },
}
```
2022-01-02 19:41:21 -07:00
Wez Furlong
c29212be49 add colors.dead_key_cursor to signal dead and leader key processing
When set, the cursor will change to this color during dead key
or leader key processing.

```lua
return {
  colors = {
    dead_key_cursor = "orange",
  },
}
```

refs: #686
refs: #688
2022-01-02 17:49:32 -07:00
Wez Furlong
79ab6e8103 window: add deadkeystatus event
Plumbs it for Windows.
Doesn't do anything useful with it yet.

refs: #688
2022-01-02 17:00:18 -07:00
Wez Furlong
d5726ba91a window: add RawKeyEvent concept
on macos only (for now), we generate a RawKeyEvent prior to
dead key or IME composition and route it to the window to give it
a chance to handle the event.

RawKeyEvent handling is scoped only to key assignments, not generating
input for the terminal.

A raw key event can be marked as handled to prevent moving on to
performing composition and generating cooked key input.

refs: https://github.com/wez/wezterm/issues/877
2022-01-02 15:04:27 -07:00
Wez Furlong
69e8d9144c gui: allow matching keys with a physical position
```lua
local wezterm = require 'wezterm'

return {
  debug_key_events = true,
  keys = {
    {key="phys:Q", action=wezterm.action{SendString="woot"}},
  },
}
```

The above will send "woot" to the pane whenever the key in same
physical position as Q on an ANSI standard US keyboard is pressed.

refs: https://github.com/wez/wezterm/issues/1483
2022-01-02 01:20:21 -07:00
Wez Furlong
b15907f61f input-types: introduce PhysKeyCode type
Based on the mac constants of the equivalent functionality;
may need some tweaking for other OS's.

refs: https://github.com/wez/wezterm/issues/1483
2022-01-01 21:35:37 -07:00
Wez Furlong
ea7030ae11 clarify the purpose of wezterm start in the --help output
This makes it a bit more understandable/discoverable.

refs: #1478
2022-01-01 12:44:38 -07:00
Wez Furlong
8251e04c63 gui: invalidate windows resources when icon changes
I noticed that by myself and another user who built from source
still had the old icon show up.
2022-01-01 12:15:03 -07:00
Wez Furlong
907b92b3ea gui: box: better job at avoiding overflowing bounds
This makes the x button overflow look better when the tab titles are
wide
2022-01-01 09:03:19 -07:00
Wez Furlong
7e8e215dc7 gui: remove adjust from vertex
This comes from a time where our quads were always locked to grid
positions.  We don't need it any more: we can simply add the adjustments
to the quad positions that we set.

Removing it makes the vertex a bit smaller and reduces the amount
of GPU accessible memory we need to use.
2022-01-01 08:11:10 -07:00
Wez Furlong
0184038c55 gui: invalidate window after window:perform_action
closes: #1475
2021-12-31 10:02:15 -07:00
Wez Furlong
7efc6a6cb8 gui: ensure that the tab bar occupies a full pixel height
Otherwise we get weird vertical misalignment effects in the
terminal cell area for eg: the top of a `z` glyph being drawn
at a half pixel height.
2021-12-30 20:06:05 -07:00
Wez Furlong
1e7d552844 fonts: replace font_ptr with a font id
I'm running down a weird thing where the main font renders weirdly
when the title font is 12 pt vs the main font 10 pt.

I thought there might have been a cache invalidation issue and
realized that we could have an A-B-A style issue with the font_ptr
stuff, so I replaced it with an incrementing id.

That didn't fix the thing I was looking at, but does feel a bit
nicer overall.
2021-12-30 19:09:30 -07:00
Wez Furlong
00a393b3d1 gui: bundle and use Roboto for title font on Linux + Windows
The default we use on macOS looks decent.  Roboto is a similar
looking font that we can use for the other platforms.
I may make it the same on all three once I've had a chance
to compare it on a mac.
2021-12-30 17:51:22 -07:00
Wez Furlong
97c8cda974 gui: ls-fonts: include title font in ls-fonts output 2021-12-30 16:51:30 -07:00
Wez Furlong
561efcb8d1 gui: invalidate fancy tab bar on config reload
Otherwise we won't pick up font changes as quickly
2021-12-30 16:50:44 -07:00
Wez Furlong
07af7e0c4b gui: constrain fancy tab size to fit the width
closes: https://github.com/wez/wezterm/issues/1470
2021-12-30 09:20:51 -07:00
Wez Furlong
e5dd859ecc gui: tidy up metrics/line widths for X and + tab bar buttons 2021-12-29 09:00:50 -07:00
Wez Furlong
5608e9477b termwiz: make seqno a required param for Line
Previously, we would implicitly set it to the special SEQ_ZERO
value, but since that value always flags the row as changed,
it causes some over-invalidation issues downstream in wezterm.

This commit makes that parameter required, so that the code that
is creating a new Line always passes down the seqno from that event.

refs: #1472
2021-12-29 08:34:59 -07:00
Wez Furlong
93a9b5a7fe gui: add Poly content drawing to box model; use it for x and + buttons
This should make those buttons look a bit more consistent
2021-12-28 23:24:18 -07:00
Wez Furlong
74caa9c173 gui: fixup bottom alignment of tab bar buttons 2021-12-28 21:53:08 -07:00
Wez Furlong
add3863871 gui: add x close button in fancy tabs
closes: #1351
2021-12-28 19:15:45 -07:00
Wez Furlong
494a0983ee gui: cache shaping and layout of fancy tab bar, allow placing at bottom
We only need to recompute when the tab content changes, or when
the window is resized, plus invalidations of the shape cache
of texture atlas filling up.

Hover events don't need to re-shape.

We can now also place the tab bar at the bottom of the screen again.
2021-12-28 12:29:54 -07:00
Wez Furlong
cc2bbced82 gui: respect tab background color
The main tab area now takes the background color from the first
cell in a formatted tab bar item as the full background color
for the whole tab area, which looks a lot nicer than just the
using that color for the minimal bounding box of the tab text.
2021-12-28 10:10:13 -07:00
Wez Furlong
f92d8112ae gui: avoid seeing right-status underneath left tabs when window is small
Introduce an opaque container to hold the left items and have that
sit over the top of the floated right status area to make things
look cleaner.
2021-12-28 09:22:16 -07:00
Wez Furlong
4ca7514029 gui: tighten up fancy tab bar to 1.75 line height
Add bottom alignment for tabs and make them slightly shorter
than the right status area; this avoids some pixel gaps.
2021-12-28 08:51:09 -07:00
Wez Furlong
13ac944e7f cargo fmt
refs: #1468
2021-12-28 08:50:43 -07:00
Wez Furlong
6ac6ac45b6 lua: add pane:get_logical_lines_as_text
refs: #1468
2021-12-28 08:04:41 -07:00
Wez Furlong
f4fab10e69 gui: box model style layout/render for fancy tab bar
This commit adds a CSS box model inspired element / layout
facility, and replaces the hand implemented fancy tab bar
element render.

This makes the code for fancy tab bar much easier to read
and update.

The right status area now expands to the full height of the
tab bar area, and uses a line height of 2.0, which makes
it line up nicely in the tab bar.
2021-12-28 00:14:54 -07:00
Wez Furlong
8c7072c5ef gui: flesh out test case for wsl -l -v
closes: https://github.com/wez/wezterm/issues/1462
2021-12-27 10:39:26 -07:00
Wez Furlong
780756bea8 gui: don't warn about wsl helper function on unix
Technically is only used on windows, but I'm fine with having
it built and tested on all platforms.
2021-12-27 10:35:11 -07:00
Wez Furlong
7e90a7008c deps: update pulldown_cmark, cargo update 2021-12-27 09:49:22 -07:00
Wez Furlong
4cf90bf7a1 gui: avoid invalidating window when only a modifier key is held down 2021-12-26 12:58:14 -07:00
Wez Furlong
2464e8fb3a gui: use wsl -l -v output for launcher items
Switch to the slightly more structured verbose output of `wsl -l -v`
in the hope that we are less prone to localization issues and
are more robust in the face of future changes.

refs: #1462
2021-12-26 09:19:38 -07:00
Wez Furlong
d51ce704d9 gui: don't use win32 gui subsystem in test configuration
We won't see test output in that case, because the tests won't
be able to write to the console!
2021-12-26 09:16:22 -07:00
Wez Furlong
2e24b0fc22 gui: improve new tab button appearance for fancy tab bar 2021-12-26 08:21:09 -07:00
Wez Furlong
790b515c21 gui: allow mouse wheel to route to hovered pane
refs: https://github.com/wez/wezterm/issues/798
2021-12-25 15:37:14 -07:00
Wez Furlong
c937f0c77c cargo fmt 2021-12-25 14:01:36 -07:00
Wez Furlong
a1ff2d6415 gui: make another pass over focus/mouse event routing
refs: #1437
2021-12-25 13:59:23 -07:00
Wez Furlong
56420205e9 gui: fix over-opacity with split panes and transparent windows
closes: #1459
2021-12-25 12:20:40 -07:00
Wez Furlong
a78ff883a9 windows: query the system caption font
Use this for the tab bar font by default
2021-12-25 09:54:31 -07:00
Wez Furlong
714e74e7af fonts: move computation of title font to wezterm-fonts
Rather than hardcode a fixed default value in the config crate, define
the default as optional and leave it to the font crate to compute
the value.

This is a step towards allow introducing system dependent GUI related
code to resolve/understand the title font: we can't put that directly
in the config crate.
2021-12-25 07:49:46 -07:00
Wez Furlong
3a628527b7 gui: fix right width of right status area in fancy tab bar
refs: #1180
2021-12-24 18:07:24 -07:00
Wez Furlong
ebaf49ad6b gui: use first cell bg/fg color for fancy tab bg/fg
refs: #1180
2021-12-24 17:42:01 -07:00
Wez Furlong
240382bcf1 gui: fix fancy tab height
Always match the height of the background strip, which is
2*metrics.height.

refs: #1180
2021-12-24 16:34:45 -07:00
Wez Furlong
8eb7c3cff4 gui: fancy tab bars are now the default
Adjust the rendering and coloring a bit to make the defaults
look pretty reasonable.

refs: #1180
2021-12-24 16:23:01 -07:00
Wez Furlong
6c1710f87d mux: remove ProgDomain; just pass down default prog/cwd as appropriate
This allows making these values configurable per-domain in the
future.

refs: #1456
2021-12-24 07:52:02 -07:00
Wez Furlong
bd6072b320 avoid default_prog, default_cwd when spawning panes via ssh
refs: https://github.com/wez/wezterm/issues/1456
2021-12-23 23:24:42 -07:00
Wez Furlong
1d064e0913 Add get_foreground_process_name, expose it and cwd in PaneInformation
Add `get_foreground_process_name` to both Pane and the lua wrapper.

Add `foreground_process_name` and `current_working_dir` fields to
`PaneInformation`.  In order for those to be dynamically fetched,
switch the lua conversion for `PaneInformation` to be a UserData
with field access methods.  It's a little more verbose but allows
us to lazily compute these two new fields.

refs: https://github.com/wez/wezterm/discussions/1421
refs: https://github.com/wez/wezterm/issues/915
refs: https://github.com/wez/wezterm/issues/876
2021-12-23 18:49:17 -07:00
Wez Furlong
38087755e1 quickselect: allow changing label for custom actions 2021-12-23 16:32:20 -07:00
Wez Furlong
3a5f6f94a6 quickselect: refine out of bounds case
I now understand that it is simply because the number of matches is too
large to be represented by a two character string in the selected
alphabet.
2021-12-23 13:58:10 -07:00
Wez Furlong
4bd29ae5cc gui: fix ringing bell shape
Don't want it to be the block outline

refs: #1432
2021-12-23 11:56:40 -07:00
Wez Furlong
668d41ad5d quickselect: add QuickSelectArgs and helpers for opening urls
This commit expands quick select mode so that you can trigger it
with distinct sets of patterns (eg: urls on one key assignment,
hashes on a different key assignment), different alphabets,
and lastly, the option to perform a different action from
the default copy action.

You can pair this with `action_callback` to run lua code to
do something with the selected text.

This commit also adds `wezterm.open_with`, a helper function
for opening documents/URLs.

refs: #846
refs: #1362
2021-12-23 10:55:44 -07:00
Wez Furlong
6a265d9f72 new ActivateTabRelativeNoWrap key assignment
refs: #1414
2021-12-23 09:32:49 -07:00
Wez Furlong
3856a61527 bleh, cargo fmt 2021-12-23 08:57:24 -07:00
Wez Furlong
becd107600 gui: quickselect: instrument and avoid potential panic
The label dedup code has panicked on me a couple of times.
I managed to capture the line number, so this commit aims to
capture some state to try to understand what's going on,
and importantly, to avoid the actual panic part.

refs: #1271
2021-12-23 08:55:36 -07:00
Autumn Lamonte
0a93a58605 New optional argument 'doNotMoveCursor' for iTerm2 images. This
permits iTerm2 images to be drawn anywhere on screen without
scrolling the cursor, including the bottom row.

Also included is a check in fcwrap.rs to_range_set(), without which
was causing a panic at runtime due to subtraction from unsigned
leading to overflow.
2021-12-23 07:07:08 -08:00
Wez Furlong
162d5a79ee gui: fix switched parameters when updating initial geometry
refs: #1387
refs: #1270
2021-12-23 07:58:24 -07:00
Wez Furlong
294579fd31 term: introduce right&bottom padding to ImageCell
This helps us correctly set the size of the image cell
for the case where we have a partial cell at the right/bottom
edge of an image being mapped across cells.

refs: #1270
2021-12-23 07:26:49 -07:00
Wez Furlong
9ed80fb22b fix typo is commented out portion of shader 2021-12-22 21:03:19 -07:00
Wez Furlong
89d4c61dae gui: fixup shader linear->srgb math
Move away from the imprecise simple pow version and over to a
version that properly respects the linear and non-linear portions
of the curve.

refs: #1025
2021-12-22 20:57:17 -07:00
Wez Furlong
9e146beb02 gui: more fun with gamma correction
On Windows, both EGL and MESA render modes were too dark.
After a bit of hunting around what I found made EGL and MESA
consistent with my default nVidia GPL rendering was:

* Tell glium that our shader outputs srgb
* Add explicit gamma conversion from linear to srgb in the shader

AFAICT, that shouldn't be required, but it seems as though something
deep in glium really wants to apply some kind of gamma conversion,
and it seems to select the wrong kind unless we set things explicitly
to SRGB.

There are some people complaining about this in
https://github.com/glium/glium/issues/1615.

I actually tried to move entirely aware from the glium srgbtexture2d
type in the hope of having explicit control over the gamma, but the
issue is in what happens to the outputs rather than the inputs.

It appears to me as though the text now looks slightly less
intense, so I think this may be what we need for the gamma issue
in https://github.com/wez/wezterm/issues/544 and potentially
also https://github.com/wez/wezterm/issues/1025

refs: https://github.com/wez/wezterm/issues/1373
2021-12-22 18:14:52 -07:00
Wez Furlong
5c222cfcdc term: allow iterm2 file transfer protocol
Adds some plumbing to allow the GUI to implement a download handler
and connect that up for iterm2 image/file transfers that have their
inline property set to false.

Previously we'd just log an error.

Now we will by default download the file to the user's download
directory.

This behavior can be turned off via the new `allow_download_protocols`
configuration setting.

File transfers can be initiated on a remote host via the
https://iterm2.com/utilities/it2dl script.

When the download completes, a toast notification is shown that will
open the file when clicked.

refs: https://github.com/wez/wezterm/discussions/1450
2021-12-22 09:21:39 -07:00
Wez Furlong
1c9b9f69e0 gui: simplify some text cursor rendering
Remove special case for blocks where we switched it out for a blank
sprite and instead varied the cell background.

We now always render a matching cursor sprite as a separate layer
over the top of the text background color, but below the text
foreground layer.

This is preparing for https://github.com/wez/wezterm/issues/1432

Make bar/line cursors use the text foreground color when reverse
video cursors are enabled, per @VKondakoff:
https://github.com/wez/wezterm/issues/1076#issuecomment-978214136
2021-12-21 22:49:52 -07:00
Wez Furlong
525739acb3 gui: revise unfocused mouse event handling
This adjusts the logic to suppress moves and clicks, but to
pass through wheel events.

refs: https://github.com/wez/wezterm/issues/1437
2021-12-21 21:48:20 -07:00
Wez Furlong
b40f65c25e termwiz: s/Fuschia/Fuchsia/g
closes: #1407
2021-12-21 20:38:59 -07:00
Wez Furlong
d2e73e10cf gui: make unfocused bar cursor more distinct from focused bar
This isn't perfect and I'm not 100% sure about it.

refs #1445
2021-12-21 08:56:21 -07:00
Wez Furlong
37c83b8308 deps: update 2021-12-20 08:15:56 -07:00
Wez Furlong
e9f1297b45 mux: improve Window closing behavior
Finally getting around to fixing this usability wart: this commit
changes the behavior of Window closing so that you can close a window
containing multiplexer panes without prompting and without killing
off those panes.

This is achieved through some plumbing:

* The mux can now advise Domains about an impending window closure,
  giving them the opportunity to "do things" in readiness.
* The mux client domain informs the container ClientPane instances
  to ignore the next Pane::kill call, which would otherwise inform
  the mux server to kill the remote pane
* Pane:can_close_without_prompting now requires a CloseReason.
* ClientPane's can_close_without_prompting impl allows Window closing
  without prompting on the assumption that the ignore-next-kill hack
  above is working

refs: #848
refs: #917
refs: #1224
2021-12-19 09:07:11 -07:00
Wez Furlong
9e9e76bf0a mux: Pane::reader now returns Result<Option<Read>>
The mux client just returns a dummy reader, and some overlays
have panicking stubs: just allow for them to return None
instead of potentially spawning a useless thread.
2021-12-19 06:30:39 -07:00
Wez Furlong
2412e663f8 gui: add missing dep for windows
refs: #1402
2021-12-17 21:28:41 -07:00
Wez Furlong
120a3dfe12 gui: improve how we handle online changes to update checking config
Previously, we would only look at the `check_for_updates` config
on startup.

This commit adjusts the update checker logic so that we always
start it, and that we respect config reloads.
2021-12-17 21:23:57 -07:00
Wez Furlong
1d4a0a9592 gui: improve update notifications
Only show the update window and/or generate a toast notification
is the current wezterm-gui process is the eldest of the set of
running wezterm-guis.

This avoids spamming the user with update information.

refs: https://github.com/wez/wezterm/issues/1402
2021-12-17 21:13:07 -07:00
Wez Furlong
c33f548db3 gui: explicitly track click-to-focus state
we need to skip processing mouse events while in that state,
until we see the mouse release.

refs: #1310
2021-12-12 22:45:46 -07:00
Wez Furlong
ada35ff3db gui: improve handling of dpi changes especially during window creation
This fixes up the Windows issue, but I wonder if it also helps with the
mac issue?

refs: https://github.com/wez/wezterm/issues/1039
refs: https://github.com/wez/wezterm/issues/1381
2021-12-12 09:27:37 -07:00
Wez Furlong
20e424f54b add default_gui_startup_args config
closes: https://github.com/wez/wezterm/issues/1030
2021-12-11 23:18:22 -07:00
Wez Furlong
66908eabb4 add ScrollToTop and ScrollToBottom key assignments
refs: https://github.com/wez/wezterm/issues/1360
2021-12-11 22:02:31 -07:00
Wez Furlong
bf34be3ab8 gui: ResetFontAndWindowSize should use known dpi
This code was partially replicating the initial window setup
where we didn't necessarily know the dpi, but in the context
where this is run, we do know the dpi for the window, so
let's consistently use that number throughout.

refs: #1039
2021-12-11 09:43:32 -07:00
Wez Furlong
04cb8d1d3b gui: skip mouse event handling if window is not focused
The intent is to workaround what appears to be an i3 bug.
Not totally sure this is a good change, but let's try it!

Might also help with an issue on macos.

refs: #1140
refs: #1310
2021-12-10 10:33:00 -07:00
Wez Furlong
7b402678e4 gui: fix initial pixel geometry on hidpi displays
refs: #1387
2021-12-10 09:20:41 -07:00
Wez Furlong
f905ec8100 fix some unused/unread field warnings 2021-12-10 08:18:36 -07:00
Wez Furlong
348ddcb122 quickselect: de-dup labels
refs: #1271
2021-12-09 09:50:32 -07:00
Wez Furlong
b9aec2fcad tabbar: fix double wide characters in tab titles
refs: #1371
2021-12-09 08:34:19 -07:00
Wez Furlong
bde2c728bf ci: use consistent git core.abbrev setting for TAGNAME
refs: https://github.com/wez/wezterm/issues/1365
2021-12-05 19:21:06 -07:00
Wez Furlong
9ceb6357b8 Apply newly defined domains to the mux on config reload
refs: https://github.com/wez/wezterm/issues/1279
2021-12-03 22:56:03 -07:00
Wez Furlong
78d4329ca7 gui: improve how per-pane palette backgrounds are rendered
We now try to avoid black background bounaries by filling out to where
the edges of the splits are.

refs: #1256
2021-12-03 10:14:00 -07:00
Wez Furlong
0a16c90283 gui: fix double padding for pane background color position
When splitting, the bottom the pane background was offset by an
additional padding increment -> fix it!

refs #1256
2021-12-03 09:36:02 -07:00
Wez Furlong
545b70b0d5 gui: adjust how the split lines are drawn
This moves away from using special block glyphs for the lines and
just draws lines directly.

In addition, since these lines are no longer constrained to available
glyphs or glyph boundaries, we can now render lines that cross when
there are a mix of horizontal and vertical splits, which looks a
bit nicer.

refs: #1256
2021-12-03 09:29:50 -07:00
Wez Furlong
9a25a6deed fix initial window size when using fancy tab bar
closes: #1340
2021-12-02 09:13:49 -07:00
Wez Furlong
232b220d08 Avoid looping if window:set_config_overrides doesn't change the config
Assuming that the window config reloaded hook doesn't actually change
anything, this will avoid a cycle where we keep triggering the hook
over and over.
2021-12-01 08:45:12 -07:00
Wez Furlong
225e7a1243 introduce unicode_version config
This is a fairly far-reaching commit. The idea is:

* Introduce a unicode_version config that specifies the default level
  of unicode conformance for each newly created Terminal (each Pane)
* The unicode_version is passed down to the `grapheme_column_width`
  function which interprets the width based on the version
* `Cell` records the width so that later calculations don't need to
  know the unicode version

In a subsequent diff, I will introduce an escape sequence that allows
setting/pushing/popping the unicode version so that it can be overridden
via eg: a shell alias prior to launching an application that uses a
different version of unicode from the default.

This approach allows output from multiple applications with differing
understanding of unicode to coexist on the same screen a little more
sanely.

Note that the default `unicode_version` is set to 9, which means that
emoji presentation selectors are now by-default ignored.  This was
selected to better match the level of support in widely deployed
applications.

I expect to raise that default version in the future.

Also worth noting: there are a number of callers of
`unicode_column_width` in things like overlays and lua helper functions
that pass `None` for the unicode version: these will assume the latest
known-to-wezterm/termwiz version of unicode to be desired. If those
overlays do things with emoji presentation selectors, then there may be
some alignment artifacts. That can be tackled in a follow up commit.

refs: #1231
refs: #997
2021-11-25 09:00:45 -07:00
Wez Furlong
3b30230d58 windows: gui: only attach parent console when spawned by wezterm
speculative attempt to do something about https://github.com/wez/wezterm/issues/1278
2021-11-21 09:21:44 -07:00
Cédric Schieli
311eb30d7f Remove unneeded offsets in powerline outline semicircle custom glyphs 2021-11-12 18:38:11 -08:00
Cédric Schieli
7d9615b4ba Better alignment for powerline outline semicircle custom glyphs 2021-11-12 18:38:11 -08:00
Cédric Schieli
dd832dcccf Improve powerline outline semicircle custom glyphs 2021-11-12 18:38:11 -08:00
Benoit de Chezelles
fa76a64504 Improve powerline filled semicircle custom glyphs 2021-11-12 18:38:11 -08:00