1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 03:39:16 +03:00
Commit Graph

514 Commits

Author SHA1 Message Date
Wez Furlong
64271288ac gui: avoid false cache sharing in glyph cache, fix custom block advance
Since we may have two different sizes/namespaces of fonts between
the title font and the main terminal font, we need to be a bit more
careful to pass down distinguishing font information when caching
glyphs.

In addition, I noticed that the advance for custom block glyphs
(eg: powerline!) weren't right in the tab bar.  To resolve this,
when shaping, we skip using the glyph from the font and synthesize
a placeholder with the appropriate advance.
2021-10-09 13:38:15 -07:00
Wez Furlong
5a6317ebe4 gui: draw a hint of a dividing line on fancy tab edges 2021-10-09 08:34:47 -07:00
Wez Furlong
23a0d67589 make fancy tab bar corners more rounded 2021-10-09 08:12:11 -07:00
Wez Furlong
d54762bf4b gui: fixup status bar boundary math for new padding
We were truncating the right-status text because we were passing
the padded number of cols for the tab bar, but since the tab bar
now exists outside the padding, that value was too small.
2021-10-09 07:32:56 -07:00
Wez Furlong
b576b31f0a gui: more refinements to fancy tab bar presentation 2021-10-08 08:29:17 -07:00
Wez Furlong
a20fe39e50 gui: tidy up fancy tab bar layout logic
Use more euclid types to clarify what goes where and make it easier
to change this code.
2021-10-08 07:32:46 -07:00
Wez Furlong
8c3477006f Allow using unit like "1cell" or "5%" for window_padding
This commit introduces the `Dimension` type which allows specifying
a value in a variety of units; pixels, points, cells, percent.

`Dimension` needs contextual information to be evaluated as pixel
values, which makes resolving the value from the config slightly
more of a chore.

However, this type allows more flexible configurations that scale
with the font size and display dpi.

refs: #1124, #291, #195
2021-10-07 19:26:22 -07:00
Wez Furlong
9b4f7e78d6 fonts: properly fixup emoji baseline
The previous commit was partially OK, but the main cause of
emoji being wonky was this bit of macos specific code that I
added ages ago.

Remove that hack and the portion of the code from the previous
commit that was working to undo it.

This should make the baselines consistent across all platforms.

refs: #1203
2021-10-06 19:40:30 -07:00
Wez Furlong
e25deaaed1 fonts: align emoji fonts with the primary font baseline
refs: #1203
2021-10-05 22:01:21 -07:00
Wez Furlong
4eef20320d search: auto-update when the pane content changes
refs: https://github.com/wez/wezterm/issues/1205
2021-10-05 20:17:45 -07:00
Wez Furlong
87ea33f2f8 partially revert ligature cursor fix
refs: #478
2021-10-05 19:46:36 -07:00
Wez Furlong
f3159b6689 gui: add rounded corners to fancy tab buttons 2021-10-05 09:12:13 -07:00
Wez Furlong
49d77138ae gui: refine text positioning math around fancy tab bar
Avoid accidentally scaling the tab bar when using IncreaseFontSize.

Use a "better" default title font based on the platform.

Avoid a gap between bottom of tab button and dividing line at
certain font sizes.
2021-10-04 23:13:21 -07:00
Wez Furlong
97ef6b71bd gui: add filled_rectangle helper function
This is used to allocate a quad that makes a simple rectangular
block of solid color.
2021-10-04 22:30:37 -07:00
Wez Furlong
f511f9f52e gui: fixup some alignment/layout math for tab bar
bottom placement had mismatched render and hit test locations.
Tweak how we generate per-tab info for fancy tab mode.
2021-10-04 17:35:54 -07:00
Wez Furlong
839fe2d8cc resolve false style/cache/shaper sharing in fancy tab bar 2021-10-04 17:35:54 -07:00
Wez Furlong
43bc96b521 re-use core render_line function in fancy renderer
There's some false cache sharing that needs to be resolved though.
2021-10-04 17:35:54 -07:00
Wez Furlong
b1509fa0d1 re-use main shaper helper for fancy tab text rendering 2021-10-04 17:35:54 -07:00
Wez Furlong
a5319d66bd fix an issue where a selection could bleed out of a pane
When split horizontally, selecting multiple lines at the top of the left
pane could paint a horizontal selection line all the way across the rest
of the terminal to the right hand edge.
2021-10-04 17:35:54 -07:00
Wez Furlong
3da775d0e5 gui: add use_pixel_positioning mode to render_screen_line_opengl
I've tested this with the regular tab bar to prove that it essentially
works; the intent is to use it with the fancy tab bar rendering.
2021-10-04 17:35:54 -07:00
Wez Furlong
d6149382a3 gui: refactor Line shaping 2021-10-04 17:35:54 -07:00
Wez Furlong
a4956c1c05 gui: more refactoring of positioning math for cell/glyph rendering
Removes the dependency on knowing where the pane top/left position
is so that the line render routine could be used in more places.

Adjusts the tab bar and scroll bar positioning so that the tab bar
ignores window padding and is always flush with the top/bottom window
edge (full width as well), and that the scroll bar top/bottom respects
the tab bar position and height.
2021-10-04 17:35:54 -07:00
Wez Furlong
efa437b16d gui: factor y pixel coordinate out of render_screen_line_opengl
Instead, pass in the y pixel value that it should use to calculate
the position.
2021-10-04 17:35:54 -07:00
Wez Furlong
fae5435824 fix incorrect fg color when cursoring over ligatured glyph
More of a "fix"; we use some heuristics based on the bearing
and glyph width to figure out if a sequence looks like a funky
ligature that moves left to render the glyph.

This may be prone to false positives, but the consequences are low:
when we think a glyph is part of a ligature, then rather than using
the cursor_fg color (which is typically black, or close to invisible),
we retain the normal text fg color.

This way the portion of the glyph outside of the cursor retains its
foreground color, and just the cell containing the cursor may have
a slightly funky fg color in the case where the heuristic was bad.

closes: #478
2021-10-04 17:35:54 -07:00
Wez Furlong
904d2a948d tidy up milli uptime for blinking text 2021-10-04 17:35:54 -07:00
Wez Furlong
b4255c3b86 Refactor shaping helper 2021-10-04 17:35:54 -07:00
Wez Furlong
962e44bbfb WIP: fancier tab bar
`use_fancy_tab_bar` switches to an alternate rendering of the tab
bar that uses the window_frame config to get a proportional
title font to use to render tabs, as well as rendering a few
additional elements to space out and make the tabs feel more
like tabs.

Computing the number of tabs doesn't respect the alternate font
at this time.

Formatted tab item foreground and background colors are also
not respected at this time.

refs: #1180
2021-10-04 17:35:54 -07:00
Wez Furlong
8652f2e7d3 gui: factor tab bar drawing into own method 2021-10-04 17:35:54 -07:00
Wez Furlong
da30ecd5b3 tab bar: use UIItem for hit testing 2021-10-04 17:35:54 -07:00
Wez Furlong
401719fb01 fonts: improve cap-height and use_cap_height_to_scale_fallback_fonts
We now compute the cap-height from the rasterized glyph data.

Moved the scaling action of use_cap_height_to_scale_fallback_fonts from
glyphcache into the font resolver: when enabled, and we have data
about the baseline font and the font being resolved, then the resolving
font will be scaled such that the cap-height of both fonts has the same
pixel size.

The effect of this is that `I` glyphs from both fonts should appear to
have the same height.

Added a row of `I`'s in differing styles at the bottom of styles.txt
to make this easier to visualize.

refs: #1189
2021-10-02 18:23:51 -07:00
Wez Furlong
d3c748e18f fonts: enable matching against bitmap strike sizes
This is to handle situations such as some versions of the Terminus
bitmap font, where the individual bitmap strike sizes are broken
out across multiple individual files.

Font matching now passes down the nominal pixel height based on
the current DPI and font scale factor, and will use that to select
the font file that has the closest pixel size.

Previously, it would be potentially undefined which of the Terminus
font files would be selected.

refs: https://github.com/wez/wezterm/issues/1189
2021-10-02 09:33:55 -07:00
Wez Furlong
959da7f0bd also change cursor border color when visual bell target is cursor 2021-09-30 17:21:31 -07:00
Wez Furlong
ca89181098 bell: allow changing the cursor color when the bell is rung
I find this less distracting than both the audible and the default
background color flashing.
2021-09-29 08:02:34 -07:00
Wez Furlong
3566b82458 add wezterm connect --class option 2021-09-29 07:15:25 -07:00
Wez Furlong
72cb110b65 add audible_bell config option
This allows using the system beep sound, currently only on macos.

refs: #3
2021-09-26 12:55:19 -07:00
Wez Furlong
3b2f7b87ec gui: tweak visual bell for transparent and non-black backgrounds
refs: #3
2021-09-25 15:32:22 -07:00
Wez Furlong
0c1ad718d0 add visual bell
refs: #3
2021-09-25 12:40:22 -07:00
Wez Furlong
2337c06c0f gui: new bell event for running lua when the bell is rung
This commit adjusts the the window event routing/queuing so that
a queued event can capture a pane_id other than the focused pane.

Since we only allow one queued instance of a given named event in a
window, a consequence of this is that multiple bell events coming
from different panes at the same time may race and the loser's
event will be dropped. We log a warning in that case.

refs: #3
2021-09-23 08:22:01 -07:00
Wez Furlong
a2110fed6f gui: add mouse event logging
refs: #1140
2021-09-14 08:43:55 -07:00
Wez Furlong
8282faf31f window: allow specifying window resize increments on macos and x11
This commit introduces a mechanism for specifying resize increments
for a window, and then arranges for the termwindow to set those
to match the current font cell metrics.

This should help to avoid cases where there is excess padding pixels
resulting from the window being slightly larger than computed number
of cells and the font metrics.
2021-09-08 22:57:42 -07:00
Greg V
94ede1e8f1 window: implement window movement by dragging on Wayland 2021-09-08 17:45:48 -07:00
Greg V
ce5615082c gui: cancel mouse click streak when the cursor has moved to a different cell (fixes #910)
Fast-clicking users generally expect to be able to rapidly do regular selections
or otherwise cancel double/triple/quad clicks, so significant mouse movement should end the streak.

Allowing tiny pixel movements to account for touchpads is necessary.
Fortunately, the position here is already in character grid cells, which provides enough margin for this.
Other code editors like gedit also seem to do this based on the character grid.
2021-09-08 17:38:59 -07:00
Spyros Roum
bfaf46a196 Also accept shift + y/n when asking for confirmation to close panes 2021-09-08 09:33:08 -07:00
Wez Furlong
aa61a6b065 gui: force cursor to be visible in copy mode
It appears as though kakoune hides the terminal cursor and renders
its own version of the cursor.

The hidden state was being picked up by the copymode overlay,
making it awkward to use.

This commit forces the cursor to be visible (and a block) when
copy mode is active.

closes: #1113
2021-09-06 19:51:20 -07:00
Wez Furlong
41866a0b5b gui: capture new terminal size even if we haven't setup opengl
I think this is a hangover from the older logic to figure out
the initial sizing, and I suspect that it is what is causing
refs: 1074

So this is a speculative change to see if it helps!
2021-09-06 10:19:06 -07:00
Wez Furlong
93e18b2a01 deps: colorgrad -> 0.5 2021-09-05 23:27:01 -07:00
Wez Furlong
545a8fc8a7 deps: ordered-float -> 2.8 2021-09-05 23:25:37 -07:00
Wez Furlong
fea3a527dd Fixed invisible I-beam/underline cursor w/force_reverse_video_cursor
closes: https://github.com/wez/wezterm/issues/1076
2021-09-04 14:24:58 -07:00
Wez Furlong
4c8ccf8efc Add Multiple key assignment
refs: https://github.com/wez/wezterm/pull/1091
2021-09-04 13:01:34 -07:00
Wez Furlong
bc4ed3735d Add SendKey key assignment
refs: https://github.com/wez/wezterm/pull/1091
2021-09-03 12:07:17 -07:00