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

350 Commits

Author SHA1 Message Date
Wez Furlong
d1e2108ce0 improve invalidations when resizing, adjusting viewport from overlay 2021-05-30 08:26:42 -07:00
Wez Furlong
8931afba5c fix more laggy invalidations
in the same vein as d657721163, the
increased idle loop means we need to be careful not to suppress
invalidation events.

In this case, overlays aren't from the window in the mux model,
so we'd ignore invalidations for those.

While looking at this I realized that we'd also do the same
for output being emitted in panes that were not the active pane,
so tidy that up.
2021-05-29 09:36:30 -07:00
Wez Furlong
257d323062 fixup laggy mux connections for recent idle changes
in the same vein as d657721163
this commit introduces more assertive signalling from the remote
mux when a pane is closed so that the client can update.
2021-05-29 00:16:27 -07:00
Wez Furlong
030e517b43 deps: metrics 0.15 -> 0.16, cargo update 2021-05-24 07:57:03 -07:00
Wez Furlong
930927fb69 gui: refactor: move resize method to resize module 2021-05-23 18:39:02 -07:00
Wez Furlong
f78190ec9c filedescriptor: remove anyhow from public interface
Use thiserror instead
2021-05-23 14:24:01 -07:00
Arvedui
dbc278e59a Fix spawning new tabs/windows in directory with urlunsafe paths
The CWD is internally stored as URL. The path component is therefore
stored percent_encoded. It must be decoded before use.
2021-05-18 08:33:06 -07:00
Wez Furlong
69561b96c8 fix wrong starting row for split paints when tab bar is at bottom
refs: https://github.com/wez/wezterm/issues/797
2021-05-15 07:47:33 -07:00
Wez Furlong
a59e9b1706 update metrics 0.14 -> 0.15
closes: https://github.com/wez/wezterm/pull/778
2021-05-11 19:20:24 -07:00
Wez Furlong
c2afe83d5d optimize resize event processing during live resize
This works by coalescing a sequence of resize/repaint events and
taking the most recent one.
2021-05-09 10:28:25 -07:00
Wez Furlong
e92e912443 refactor WindowEvent handling 2021-05-09 09:58:20 -07:00
Wez Furlong
b8acdf592f fix panic when double-click-selection drags across line boundary
closes: https://github.com/wez/wezterm/issues/762
2021-05-09 08:17:56 -07:00
Wez Furlong
f4e9668952 fix scaling of --> ligature in base font
refs: https://github.com/wez/wezterm/issues/699
2021-05-09 07:19:18 -07:00
Wez Furlong
4e6f341f10 window: wayland support is no longer optional at build time 2021-05-08 17:48:58 -07:00
Wez Furlong
fdce2d71d0 decompose period maintenance function
Split it into its component parts, and change the new dispatch
loop to sleep the appropriate interval only when needed.

refs: #770
2021-05-08 12:28:19 -07:00
Wez Furlong
b5bf25a9c5 remove check_for_dirty_lines_and_invalidate_selection from periodic
Since we now always check this during rendering, and we have a reliable
event for pane output, we don't need this check in the period task.

refs: #770
2021-05-08 11:32:12 -07:00
Wez Furlong
ed6987298a mux: remove window invalidation polling
Add a mux event for this insteead.

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 11:25:03 -07:00
Wez Furlong
58157c47a9 config: can now subscribe to config change events
This removes a couple of periodic config polls

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 11:06:07 -07:00
Wez Furlong
1cbaf55640 change mux empty poll to mux empty event
As part of reducing the amount of regularly scheduled stuff wezterm
does in the background, this commit restructures how an empty mux
is detected; now when the mux prunes dead windows it will emit
an Empty event.

The Activity type will now schedule a prune when it is dropped,
which will clean up and trigger the Empty event.

refs: https://github.com/wez/wezterm/issues/770
2021-05-08 10:25:49 -07:00
Wez Furlong
7cd9f32494 add some error context on notif dispatching
This was helpful when running down the situation in the previous
commit.
2021-05-08 10:21:44 -07:00
Wez Furlong
2e74663628 fixup log level for context loss 2021-05-08 09:36:19 -07:00
Wez Furlong
5d037eae52 adjust gui layer for window changes 2021-05-08 09:36:19 -07:00
Chris
2add312c5c
Allow VoidSymbol keycode to be seen by wezterm (#759)
* allow voidsymbol for key code

* update docs, cleanup

* cleanup and fmt of files

* remove unnecessary inputs
2021-05-07 07:54:24 -07:00
Wez Furlong
d64b785290 deps: update windows dep to 0.4 -> 0.9
dependabot keeps trying and failing because lots of things changed.
Let's try and get ahead of it...
2021-05-03 22:05:35 -07:00
Wez Furlong
a594298947 add window object to debug overlay
refs: https://github.com/wez/wezterm/issues/641
2021-05-03 18:36:26 -07:00
Wez Furlong
09f0421b48 add lua repl to the debug overlay
`wezterm` is pre-imported.
The repl prints the result of the expressions to the overlay.

refs: https://github.com/wez/wezterm/issues/641
2021-05-03 09:19:44 -07:00
Wez Furlong
8b71a57513 add debug overlay
Adds a `ShowDebugOverlay` key assignment that will create a tab
overlay that shows a limited number of recently logged events.

refs: https://github.com/wez/wezterm/issues/641
2021-05-03 09:19:38 -07:00
Wez Furlong
7a86f1b2b8 fixup word selection on long lines
This got a bit broken by the fix for https://github.com/wez/wezterm/issues/714

since we can be handed a range of logical line fragments, we should
test each of them to find our matching result.

Also, improve the logic for constraining the length when looking
backwards.
2021-05-02 12:40:16 -07:00
Wez Furlong
6919630810 refactor: new_window is now async
This doesn't really change anything, but it makes it a little
simpler to integrate wgpu in a later commit.
2021-05-02 12:05:28 -07:00
Wez Furlong
8880979586 Adjust font scaling math again
This commit introduces the knowledge about whether a font is
scalable or was using bitmap strikes (eg: color emoji bitmaps).

Then that information is used to help figure out whether and
how to scale a glyph.

refs: https://github.com/wez/wezterm/issues/685
2021-05-01 16:45:57 -07:00
Wez Furlong
d4da670294 docs for and minor tweak of curly underline improvement
refs: https://github.com/wez/wezterm/pull/733
2021-04-30 09:22:01 -07:00
Roland Fredenhagen
7b274d460e
Better function for undercurl (#733)
* Better function for undercurl

* Setting lower alpha

* underline alpha in line-frag

* make undercurl alpha background independent

* Improved Shader

* Old Rasterization

Co-authored-by: Roland Fredenhagen <git@modprog.de>
2021-04-30 09:19:43 -07:00
Wez Furlong
0316dfeb83 term can now notify application about potential title updates
When the title, icon, OSC 7 and SetUserVars sequences are processed,
notify the embedding application.

The gui layer uses this to trigger a titlebar update.

refs: #647
2021-04-30 07:28:02 -07:00
Wez Furlong
35eb7383b1 ci: simplify version number
Previously, we used `git describe --tags` to produce a version number
for non-released builds derived from the most recent tag + some info
such as the number of commits since that tag and then `g{HASH}`.

That always confuses people because the date portion at the front
looks old (it is typically the previous release) and the hash at
the end has that `g` in it.

This commit simplifies both the tag name used when making a release
and the computed version number take the date/time from the current
commit, and then append the hash.  That way the version number always
corresponds to a commit.

This scheme doesn't help detect situations where the commit is
dirty, but I don't think the old one would have helped with that
either.
2021-04-29 20:23:47 -07:00
Wez Furlong
94c98aa826 quickselect: fixup edge case with wrapped lines
the binary search would falsely extend the end of the match
to the start of the subsequent match for the wrapped line case.

The resolution is to emit a coordinate for the newline that we
add to the haystack between the wrapped lines.

closes: https://github.com/wez/wezterm/issues/732
2021-04-29 17:15:49 -07:00
Wez Furlong
d547f45714 avoid vanishing cursor when wrapped line is initially 0-width
refs #740
2021-04-29 16:06:43 -07:00
Wez Furlong
6d7f9879ac be more aggressive at pruning trailing blanks 2021-04-29 16:00:33 -07:00
Wez Furlong
7de7bf6b9e optimize render for blanks-after-clusters
In the situation where we have a full screen terminal (eg: 500 cells
wide), but very little output (eg: only 10's of columns on the left are
NOT blank), we would previously spend a non-trivial amount of time
calculating fg/bg colors for the blanks that trailed the actual
clusters; the calculation for each row was:

  O(trailing-blanks * full cell color compute cost)

which was around 30us per row.  For large numbers of rows this could
add up to >10ms per frame.

This commit changes the logic to run in two phases:

 * O(selection-width) with simple fg/bg color updates for the selection
   range

 * O(1) full cell color compute cost for the cursor if the cursor
   is somehow in the trailing blank region and not already handled
   by the earlier clustering logic.

With the sequence of recent commits, the frame time for the large
terminal case has been reduced from ~22ms to ~7ms, which is approx 3x
improvement.

refs: #740
2021-04-29 10:08:51 -07:00
Wez Furlong
20a599a372 fix test compilation 2021-04-28 18:07:07 -07:00
Wez Furlong
f91ca30008 micro-optimize clustering
This improves it by ~4x for long lines, taking it from 120us to ~30us.
2021-04-28 08:25:07 -07:00
Wez Furlong
8953bff276 fonts: pre-size some vecs
micro optimization really
2021-04-27 22:39:32 -07:00
Wez Furlong
d6c8eb1e3b benchmarking shaping
`cargo test --release -p wezterm-gui -- --nocapture bench_shaping`:

```
running 1 test
100: 139.82µs
1000: 385.333µs
10000: 3.144203ms
test shapecache::test::bench_shaping ... ok
```
2021-04-27 21:48:15 -07:00
Wez Furlong
e9fcc98d4a quickselect: allow pasting when typing the uppercase prefix
revise the colors to be a bit less glaring.

Updated the screenshot

refs: https://github.com/wez/wezterm/issues/732
2021-04-27 07:06:55 -07:00
Wez Furlong
d176af9c30 tidy up format-tab-title, add tab_max_width parameter
refs: https://github.com/wez/wezterm/issues/647
2021-04-26 21:43:30 -07:00
Wez Furlong
be9c60bfc8 removed tab_bar_style options in favor of format-tab-title
refs: https://github.com/wez/wezterm/issues/647
2021-04-26 20:16:47 -07:00
Wez Furlong
3ad2a46ecf quickselect: avoid a panic when used with mux
It looks like the mux search results include a trailing newline
in some cases, which means that a match can wrap onto a second
line.

If that line is shorter than the label length, we could panic.

This commit makes quickselect safer to use in this situation,
but the real fix is with the mux search code.
2021-04-26 09:58:16 -07:00
Wez Furlong
d907b86a91 fixup captures in default quickselect patterns
Change some of the grouping to non-capturing expressions,
and remove redundant whole-expressing captures

refs: #732
2021-04-26 08:38:45 -07:00
Wez Furlong
3028756ccb add tab_bar_at_bottom config option
closes: https://github.com/wez/wezterm/issues/278
2021-04-25 20:49:48 -07:00
Wez Furlong
f3679b024d fix mouse x position calc in tab bar
close: https://github.com/wez/wezterm/issues/677
2021-04-25 19:55:36 -07:00
Wez Furlong
f3706c706c de-hover tab when moving cursor down into the terminal
It's not perfect; this only handles the case where you move down
into the terminal.  I couldn't easily make the same thing happen
when moving the mouse up or left outside of the window.  It's
probably fixable but this is better than it was.

closes: https://github.com/wez/wezterm/issues/591
2021-04-25 17:01:21 -07:00
Wez Furlong
8ce376753f round out quick select mode
* Make alphabet and patterns configurable
* add docs
* Enhance scrollback search to support regex captures so that
  searching for eg: `fo(o)` will select the last `o` in `foo`.

refs: https://github.com/wez/wezterm/issues/732
2021-04-25 16:27:39 -07:00
Wez Furlong
87677a73bf Add support for iTerm2's SetUserVar escape
This doesn't propagate across wezterm's mux protocol
at this time.

refs: https://github.com/wez/wezterm/issues/647

https://iterm2.com/documentation-scripting-fundamentals.html#setting-user-defined-variables
2021-04-25 14:30:06 -07:00
Wez Furlong
1cb2856223 add hover parameter to format-tab-title
refs: https://github.com/wez/wezterm/issues/647
2021-04-25 13:53:06 -07:00
Wez Furlong
5b1631fe21 add quickselect overlay
This is the first pass implementation, drawing on the alphabet logic
and default patterns from tmux-thumbs (thanks @fcsonline!).

ctrl-shift-space pops up the quick select overlay.
Typing the highlighted prefix will select the matching text and
copy it as though the `Copy` key assignment was used.

TODOs are to make the alphabet and patterns configurable, as well
as write up some docs.

refs: #732
2021-04-25 11:52:14 -07:00
Wez Furlong
a69447fc2a nominally support toast notif timeouts
I've built this on linux, which doesn't respect the timeout.
I've made speculative changes that should build on mac and windows,
but that don't plumb the timeout functionality on those systems
as of yet.

refs: #619
2021-04-25 08:52:43 -07:00
Wez Furlong
2c89e47f9e add force_reverse_video_cursor option
refs: https://github.com/wez/wezterm/issues/706
2021-04-24 21:16:58 -07:00
Wez Furlong
09e101c268 add format-tab-title event
refs: https://github.com/wez/wezterm/issues/647
2021-04-24 17:59:39 -07:00
Wez Furlong
e3fcdc9f36 add format-window-title event
This provides a flexible way for users to customize what gets
shown in the window title bar.

closes: https://github.com/wez/wezterm/pull/603
2021-04-24 16:47:26 -07:00
Wez Furlong
1f8908cddb fonts: revise cap_height adjustment
back out the portion of the cap height scaling that applied when
we knew the cap height of the primary font but not a fallback font.

That logic allowed some overly wide powerline fonts to be sized
correctly (a bit smaller), but also meant that a number of emoji
and other symbol glyphs were now undersized.

refs: https://github.com/wez/wezterm/issues/727
2021-04-24 12:02:52 -07:00
Wez Furlong
87d49e45fc fix: multi-glyph tab titles
closes: https://github.com/wez/wezterm/issues/711
2021-04-23 22:51:53 -07:00
Wez Furlong
d705886b53 Add pane_focus_follows_mouse
closes: https://github.com/wez/wezterm/issues/600
2021-04-23 22:17:33 -07:00
Wez Furlong
657ed92d82 add swallow_mouse_click_on_pane_focus option
refs: https://github.com/wez/wezterm/issues/724
2021-04-23 22:17:06 -07:00
Wez Furlong
f97df9307a fix scaling for square glyphs
a copy-paste/transcription error had the y value divided by the cell
width rather than the x value.

refs: https://github.com/wez/wezterm/issues/707
2021-04-23 21:03:10 -07:00
Wez Furlong
91cd2e22e4 prefer local/specific config for a couple more cases
Avoid using `configuration()` when there may be a more specific
config with overrides that we can resolve.
2021-04-16 09:04:51 -07:00
Wez Furlong
76353a6240 fix: InputMap reading global config instead of window overrides
refs: #656
2021-04-16 08:59:49 -07:00
Wez Furlong
67d8848676 ls-fonts: refine output a bit
It now outputs something that you could conceivably put into
your config file, although the intent is to show the canonical
way to reference the individual fonts that were found, rather
than to specify a fully baked list to paste into a config.

eg:

```
; ./target/debug/wezterm ls-fonts
Primary font:
wezterm.font_with_fallback({
  -- /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontDirs
  {family="Operator Mono SSm Lig", weight="DemiLight"},

  -- /home/wez/.fonts/OperatorMonoSSmLig-Medium.otf, FontConfig
  {family="Operator Mono SSm Lig", weight="DemiLight"},

  -- /home/wez/.fonts/MaterialDesignIconsDesktop.ttf, FontDirs
  "Material Design Icons Desktop",

  -- /home/wez/.fonts/terminus-bold.otb, FontDirs
  {family="Terminus", weight="Bold"},

  -- /home/wez/.fonts/JetBrainsMono-Regular.ttf, FontDirs
  "JetBrains Mono",

  -- /home/wez/.fonts/NotoColorEmoji.ttf, FontDirs
  "Noto Color Emoji",

  -- /home/wez/.fonts/MaterialDesignIconsDesktop.ttf, FontConfig
  "Material Design Icons Desktop",

  -- /usr/share/fonts/terminus-fonts/ter-u32n.otb, FontConfig
  "Terminus",

  -- /home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig
  "JetBrains Mono",

  -- /home/wez/.fonts/NotoColorEmoji.ttf, FontConfig
  "Noto Color Emoji",

  -- <built-in>, BuiltIn
  "Last Resort High-Efficiency",

})
```
2021-04-14 09:06:02 -07:00
Wez Furlong
3fae59b01b fonts: use cap-height metric to scale fallback fonts
we now compute the ratio of the cap height (the height of a capital
letter) vs. the em-square (which relates to our chosen point size) to
understand what proportion of the font point-size that a given font
occupies when rendered.

When rendering glyphs from secondary fonts we can use the cap height
ratios of both to scale the secondary font such that its effective
cap height matches that of the primary font.

In plainer-english: if you mix say bold, italic and regular text
style in the same line, and you have different font families for
those fonts, then they will now appear to be the same height where
previously they may have varied more noticeably.

For emoji and symbol fonts there may not be a cap-height metric
encoded in the font.  We can however, improve our scaling: prior
to this commit we'd use the ratio of the cell metrics of the two
fonts to scale the icon/emoji glyph, but this could cause the glyph
to be slightly oversized as seen in https://github.com/wez/wezterm/issues/624

If we know the cap-height of the primary font then we can additionaly
apply that factor to scale the emoji to better fit the cell.

While looking at this, I noticed that the aspect ratio calculation
for when to apply to the allow_square_glyphs_to_overflow_width option
had width and height flipped :-(

See also: https://tonsky.me/blog/font-size/
refs: https://github.com/wez/wezterm/issues/624
2021-04-13 23:02:27 -07:00
Wez Furlong
776aedf97e fonts: allow specifying weight/stretch/italic for each fallback font 2021-04-12 22:30:55 -07:00
Wez Furlong
2e34f1a8dd Add wezterm ls-fonts subcommand
At this time it just shows you the fonts that your config matches
and where they came from:

```
; wezterm -n ls-fonts
Primary font:
  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Italic=true:
  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=true)
    (/home/wez/.fonts/JetBrainsMono-Italic.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Intensity=Bold:
  wezterm.font("JetBrains Mono", weight="Bold", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Bold.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

When Intensity=Bold Italic=true:
  wezterm.font("JetBrains Mono", weight="Bold", stretch="Normal", italic=true)
    (/home/wez/.fonts/JetBrainsMono-Bold-Italic.ttf, FontConfig)

  wezterm.font("JetBrains Mono", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/JetBrainsMono-Regular.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Noto Color Emoji", weight="Regular", stretch="Normal", italic=false)
    (/home/wez/.fonts/NotoColorEmoji.ttf, FontConfig)

  wezterm.font("Last Resort High-Efficiency", weight="Regular", stretch="Normal", italic=false)
    (<built-in>, BuiltIn)

```

refs: #347
2021-04-12 09:44:27 -07:00
Wez Furlong
e5665e80a1 add window:toast_notification method
refs: https://github.com/wez/wezterm/issues/619
2021-04-11 22:01:06 -07:00
Wez Furlong
16701f61b4 fix new-tab hover calculation
refs: https://github.com/wez/wezterm/issues/677
2021-04-11 16:10:14 -07:00
Wez Furlong
180f125830 fix gaps in multi-cell ligatured glyphs
refs: https://github.com/wez/wezterm/issues/614
2021-04-10 13:59:59 -07:00
Wez Furlong
c312983643 Ensure that we propagate OutOfTextureSpace errors
otherwise we won't be able to show many glyphs beyond those that
fit in the initial texture atlas!

refs: https://github.com/wez/wezterm/discussions/672
refs: https://github.com/wez/wezterm/issues/671
2021-04-10 07:26:19 -07:00
Wez Furlong
b825f86380 avoid incomplete paints if loading a glyph fails
This addresses the render artifacts aspect of https://github.com/wez/wezterm/issues/671

For whatever reason, some font(s) cannot be loaded on that system
and that results in the paint routine erroring out.

This commit avoids the error by substituting a blank glyph
instead of the glyph that failed to load.

refs: https://github.com/wez/wezterm/issues/671
2021-04-10 00:21:00 -07:00
Wez Furlong
16e7457049 x11: notice dynamic changes to Xft.dpi
This commit allows the x11 window implementation to detect changes
in the DPI that occur after a window is created.

These can occur when changing desktop resolution or when changing
the accessibility option for "Large Text" in gnome.

In order to avoid continually polling for the value on every resize,
we look for the `_GTK_EDGE_CONSTRAINTS` atom in our property change
notifications.  This seems to be sent at least as often as the
dpi/scaling changes.

It's also worth noting that some dpi changes don't generate resize
events, so we can't just read the dpi value on every resize, because
we'd miss some of those changes.

Part of this commit changes the font scaling logic: previously
we'd keep a notion of "dpi scale" to apply.  That dates from an
earlier time in wezterm where we didn't think that we knew an
actual dpi value.

The way that worked was that we'd compare our current guestimate
of the DPI against what we though the baseline OS dpi should be to
produce a scaling factor.

On X11 that dpi value is global and we'd effectively always produce
a revised scaling factor of 1 after we'd set up the initial window.

This commit changes that logic to just pass down the actual DPI value
to the font code.  That DPI value already accounts for HiDPI scaling
so this is hopefully a NOP change for the other systems.

refs: https://github.com/wez/wezterm/issues/667
2021-04-09 09:23:25 -07:00
Wez Furlong
ecc500af05 ssh: don't override the ssh config User value 2021-04-08 16:17:49 -07:00
Gus Wynn
dee10c2f21 Support unicode charaters in 2021-04-08 15:42:39 -07:00
Wez Furlong
6830d171cf fixup metrics when line_height==1.0
This was broken by b441be3ac9

For whatever reason, the breakage was only visible with the Iosveka
font on Windows.  I couldn't reproduce it on my other systems, even
though the code technically applies to any system.

The breakage was: the metrics resulted in a difference of about 0.4
pixels being used for the descender with that particular font, resulting
in weird vertical alignment problems.

The offset needs to be computed against the ceil of the cell height,
which removes the fractional offset.

refs: https://github.com/wez/wezterm/issues/661
refs: https://github.com/wez/wezterm/issues/582
2021-04-08 09:48:47 -07:00
Wez Furlong
81946d0144 fix under-invalidation of the selection
The repro scenario for this case was:

* open GNU nano
* hit enter twice
* type hello
* move the text cursor to the top line
* double click on hello
* hit enter

Prior to this commit, the selection would remain on the now-blank line
that previously held `hello`.

refs: #644
2021-04-07 08:43:45 -07:00
Wez Furlong
5cc29d1d8c wezterm-mux-server: keep running after all panes are gone
This has been a commonly requested feature in the past week,
and it's a reasonable one.  The mux server inherited the
close-when-done behavior from when it used to be an alternate
front-end in the same executable as the gui, but it doesn't
need to be that way any more.

We also need to accomodate that case in the client: if the
newly attached domain doesn't result in any panes being imported,
we need to spawn a new command there in order to keep the client
alive.  The pre-existing check for whether the mux was empty had
false positives because the local mux may still reference the
pane from the connection UI, which would finish closing out shortly
after we had decided not to spawn anything, and then the client
would close.

refs: https://github.com/wez/wezterm/issues/631
refs: https://github.com/wez/wezterm/issues/507
2021-04-03 15:00:08 -07:00
Wez Furlong
b441be3ac9 gui: vertically center cell within adjusted line height
When line_height is specified, rather than applying the offset
to just the top of the cell, apply it in equal parts to the top
and the bottom so that the cell is vertically centered.

closes: https://github.com/wez/wezterm/issues/582
2021-04-03 10:41:28 -07:00
Wez Furlong
4112b74f8a spawn local domain when starting gui in mux mode
This allows explicitly spawning commands locally, rather than
in the target mux.

this is similar to 12225a099a

refs: https://github.com/wez/wezterm/issues/468
2021-04-03 09:18:24 -07:00
Wez Furlong
298e0b8d76 hide mouse cursor each time we send key input to a pane
Mouse movement will show the cursor again.

macOS: fix hiding the cursor

refs: https://github.com/wez/wezterm/issues/618
2021-04-02 22:34:58 -07:00
Wez Furlong
4a3e0615f5 tweak ActivateLastTab and add a changelog entry for it
refs: https://github.com/wez/wezterm/pull/610
2021-04-02 09:29:52 -07:00
Alex Gartrell
ee4b4b598c Add ActivateLastTab command
This replicates `last-window` in tmux. To pull this off, I
deliberately store the last tab whenever I'm activating a new one or
spawning a new one. I had to do this explicitly rather than hooking
set_active, because we end up setting the active tab briefly for some
common operations like moving a tab.
2021-04-02 09:14:59 -07:00
Wez Furlong
d45bbed3fd ssh: fix handling wezterm ssh user@host:22 2021-03-29 21:21:31 -07:00
Wez Furlong
32fa186c99 wezterm-gui: add wezterm ssh -oIdentityFile=/some/thing
Allow overriding ssh config options from the command line.

I don't want to replicate the many options that `ssh(1)` has;
this just exposes the `-oNAME=VALUE` syntax.  The config names
are those from `man ssh_config`; `IdentityFile` rather than `-i`.

refs: #457
2021-03-28 08:24:35 -07:00
Wez Furlong
12225a099a fix spawning new tabs via launcher menu
I wonder how long this has been broken... rather than spawning
into domain "local" it would try to spawn into "`local`" and fail
silently because the error message wasn't logged.

So let's log it, and let's fix it.

refs: https://github.com/wez/wezterm/issues/468
2021-03-27 19:00:55 -07:00
Wez Furlong
53a13e60f5 start up "local" domain when spawning ssh
allows defining launch_menu items to spawn explicitly locally:

```lua
return {
  launch_menu = {
    {
      label = "Local zsh",
      args = {"zsh", "-l"},
      domain = {DomainName="local"},
    },
  }
}
```

refs: https://github.com/wez/wezterm/issues/468
2021-03-27 18:35:28 -07:00
Wez Furlong
e103653923 RemoteSshDomain now uses wezterm-ssh crate
There are a few notable changes as a result:

* A number of `.ssh/config` options are now respected; host matching
  and aliasing and identity file are the main things
* The authentication prompt is inline in the window, rather than
  popping up a separate authentication window

Refs: https://github.com/wez/wezterm/issues/457
2021-03-27 18:12:34 -07:00
Wez Furlong
c6308202cb hyperlinks, selection by word and line deal with wrapping better
These now operate in terms of logical lines so they deal with
lines that have wrapped outside the viewport better than in
previous releases.

closes: https://github.com/wez/wezterm/issues/408
2021-03-26 14:52:00 -07:00
Wez Furlong
0f23c140d1 partial revert of prior commit; it's not quite right
https://github.com/wez/wezterm/issues/408
2021-03-26 13:52:39 -07:00
Wez Furlong
d827be990d speculatively apply hyperlinks to logical lines
This might be all that is needed to make multiline implicit hyperlinks
function, but I need to transfer this commit to another machine to try
it.

refs: https://github.com/wez/wezterm/issues/527
refs: https://github.com/wez/wezterm/issues/408
2021-03-26 13:47:27 -07:00
Wez Furlong
0643e8b0ed add window:get_selection_text_for_pane
refs: https://github.com/wez/wezterm/issues/575
2021-03-25 22:10:29 -07:00
Aaron Abramov
786888ce0a update k9 to 0.11.0 to make it work with rustc@1.51.0
1.51.0 no longer takes non string literals in `panic()`. k9@0.11.0 fixes that
2021-03-25 10:39:00 -07:00
Wez Furlong
dbd7fc28a5 Raise minimum Rust version to 1.51, de-vendor openssl on unix
Rust 1.51 allows addressesing a long-standing TODO which was that we
shouldn't need to build a vendored copy of openssl on most sensible unix
systems.

We do require a vendored copy on macOS and Windows, but due to the way
that Cargo's feature resolver worked, it wasn't possible for this
requirement to be respected.

Rust 1.51 introduces `resolver="2"` which can deal with this feature
resolution!

https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2

The upshot of this is that building wezterm on real unix systems that
are not macos will now link against the system libssl, resulting in both
a shorter compile time and less headaches arising from having a slightly
different openssl used by wezterm than the rest of the system.

cc: @jsgf
2021-03-25 09:43:50 -07:00
Wez Furlong
b876fbabd6 remove the config bridge and have window -> config directly 2021-03-23 21:56:57 -07:00
Wez Furlong
f301fc6ecc avoid potential panic when processing double wide cells 2021-03-23 08:13:26 -07:00
Wez Furlong
5d96db3349 fix tests 2021-03-22 20:54:01 -07:00
Wez Furlong
8f856d0b81 font: make system fallback async wrt. rendering
If shaping can't resolve some glyphs, queue the font locator
fallback resolution to another thread; meanwhile, a last resort
glyph is used.

That thread can trigger an invalidation once the fallback resolve
is complete, the window is invalidated and the last resort glyph
is replaced by the resolve glyph.

refs: https://github.com/wez/wezterm/issues/559
refs: https://github.com/wez/wezterm/issues/508
2021-03-22 20:42:03 -07:00