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

231 Commits

Author SHA1 Message Date
Wez Furlong
75420c1b8f cli: add move-pane-to-new-tab command
This allows moving a pane to a new tab, which can in turn be
created in a new window.

refs: https://github.com/wez/wezterm/issues/1253
2022-05-28 06:43:22 -07:00
Wez Furlong
c4a248f1a3 mux: split-pane can optionally move an existing pane into the split
This commit allows for the SplitPane internal action to use the
pane id of an existing pane as the source of the pane to be added
in the new split target, rather than spawning a new command.

This can be used to move a pane from one tab to another, and is
analagous to tmux's `join-pane` command.

refs: https://github.com/wez/wezterm/discussions/2043
refs: https://github.com/wez/wezterm/issues/1253
2022-05-27 19:47:12 -07:00
Wez Furlong
17d1170b2a windows: fix divined current working directory
The issue was that we were generating an invalid file URI; fix
that up!

refs: #2036
2022-05-26 05:56:57 -07:00
Wez Furlong
2725559fc0 paneselect: add mode parameter and a mode for swapping panes
Extends the pane selector to allow:

```
wezterm --config 'keys={{key="p", mods="CTRL", action=wezterm.action{PaneSelect={mode="SwapWithActive"}}}}'
```

to swap the active pane with the selected pane.
Similar to https://wezfurlong.org/wezterm/config/lua/keyassignment/RotatePanes.html
except that only the active and the selected panes have their positions
adjusted.

refs: https://github.com/wez/wezterm/issues/1842
refs: https://github.com/wez/wezterm/issues/1975
2022-05-24 22:52:54 -07:00
Wez Furlong
ecd05547d5 Add SplitPane assignment
This, along with the plumbing included here, allows specifying
the destination of the split (now you can specify top/left, whereas
previously it was limited to right/bottom), as well as the size
of the split, and also whether the split targets the node at the
top level of the tab rather than the active pane--that is referred
to as full-width in tmux terminology.

https://github.com/wez/wezterm/issues/578
2022-05-21 21:09:11 -07:00
Wez Furlong
d2d4257f79 Add RotatePanes key assignment 2022-05-21 17:10:04 -07:00
Wez Furlong
107d3d2378 search mode can now default to searching the selection text
To do this, we split `Pattern` into the underlying pattern for the mux
layer (which is part of the codec), and another for the config layer,
so that we can specify this new mode.

At the gui layer, we translate the selection variant into the actual
selection text and map it to the mux Pattern enum.

When taking the selection text, we restrict it to just the first line.

refs: https://github.com/wez/wezterm/issues/1912
2022-05-21 07:24:50 -07:00
Wez Furlong
b312479266 quickselect: allow multiline matches
Turn on multi-line mode by default, and improve the localpane
search function to collapse runs of trailing whitespace into
just a newline.

That allows:

```
./target/debug/wezterm -n --config 'quick_select_patterns={"foo$"}'
```

to match the first line from this, but not the second:

```
printf "foo\nfoobar\n"
```

and this to match both:

```
./target/debug/wezterm -n --config 'quick_select_patterns={"^foo"}'
```

refs: https://github.com/wez/wezterm/issues/2008
2022-05-20 09:47:08 -07:00
Wez Furlong
0e0bac2576 deps: prune some unused deps 2022-05-19 06:48:09 -07:00
Wez Furlong
2f14d640e8 config: split out lua functions into their own crates
This shaves off some build time and allows more parallism in the build.
2022-05-19 06:48:09 -07:00
Wez Furlong
55e7d845e9 Add cycle detection when converting lua values to dynamic 2022-05-18 07:47:39 -07:00
Wez Furlong
f587cac145 config: cut over to wezterm-dynamic
Avoid using serde for mapping between Lua and Rust for the `Config`
struct.

This improves the build speed of the config crate by 2x; it goes down
from 30 seconds to 9 seconds on my 5950x.
2022-05-18 07:47:39 -07:00
Wez Furlong
b833ee73b3 mux: don't kill panes when the domain is detached!
refs: #1993
2022-05-15 17:02:24 -07:00
Wez Furlong
46ca0679b1 add pane:get_foreground_process_info()
Returns all known information about the foreground process in the pane.

refs: #1987
2022-05-14 09:14:35 -07:00
Wez Furlong
262531631c mux: add Pane::perform_assignment
Allows a pane to override/implement the action for an assignment

refs: https://github.com/wez/wezterm/issues/993
2022-05-04 21:29:07 -07:00
Wez Furlong
2839293674 refactor: hide Screen::lines field
I want to make some changes to the scrollback structure that
first require routing some operations through an accessor
method, so this commit does that.

It should have no functional difference.
2022-04-21 07:14:41 -07:00
Wez Furlong
f9c4855159 procinfo: windows: tweak and add more tracing
Use an alternative function to query the executable path for
a target process.

Add more tracing.

refs: #1896
2022-04-20 09:43:56 -07:00
Wez Furlong
fb635c4362 feed unicode version config through to Line for ls-fonts
This makes the reported metrics show correctly for:

```
wezterm -n --config "font=wezterm.font('Noto Sans Mono CJK JP')" \
        --config treat_east_asian_ambiguous_width_as_wide=true \
        ls-fonts --text ".☆a☆☆☆☆"
```

refs: https://github.com/wez/wezterm/issues/1888
2022-04-19 21:12:21 -07:00
Wez Furlong
f7b34438ed add clean_exit_codes config
refs: https://github.com/wez/wezterm/issues/1889
2022-04-19 07:48:49 -07:00
Wez Furlong
66e8ec1586 mux: implicitly attach the domain referenced in a SpawnCommand
refs: https://github.com/wez/wezterm/issues/1874
2022-04-17 23:02:39 -07:00
Wez Furlong
8fbb1d0c0b mux: add AttachDomain and DetachDomain key assignments
The launcher menu code to perform attaching has been generalized
into a key assignment action and reimplemented in terms of that
action.

A detach action has been added to disconnect and detach.

refs: https://github.com/wez/wezterm/issues/1874
2022-04-17 21:41:50 -07:00
Wez Furlong
03d8f10d11 mux: pass current window_id to Domain::attach
This commit allows the currently active window to:

* Spawn a new tab in the active window (rather than spawning
  a new window) to host the connection status
* Auto-close that connection UI tab (rather than the whole window)
  when the window is no longer needed
* Pass the current window through to use as the primary window when
  assigning remote window/tabs.

The net effect of this is that there are fewer transient windows,
and that it is easier to connect a set of domains to the active
workspace.

refs: https://github.com/wez/wezterm/issues/1874
2022-04-17 18:07:58 -07:00
Wez Furlong
0f6ee20b28 pty: ExitStatus now understands signals and impl Display
Improves the fidelity of the information in ExitStatus and shows it
in the wezterm exit_behavior output to clarify the status.
2022-04-09 06:15:54 -07:00
Wez Furlong
6cad4c35e9 Improve exit_behavior messaging some more 2022-04-06 17:53:46 -07:00
Wez Furlong
1908d35d03 Improve exit_behavior messaging
refs: https://github.com/wez/wezterm/issues/1791#issuecomment-1090059541
2022-04-06 07:43:12 -07:00
Wez Furlong
27d7666a8d downloader: restructure how we propagate to the gui
same deal as 210999b915 but for the
download handler.

The download handler doesn't work across the multiplexer today.
2022-03-31 20:06:43 -07:00
Wez Furlong
210999b915 clipboard: restructure how we capture OSC 52
Previously, we'd create a clipboard handler associated with a GUI window
and take care to pass that down to the underlying Pane whenever we
spawned a new pane.

For the mux server, instead of being associated with a GUI window, the
clipboard was a special RemoteClipboard that would send a PDU through
to the client that spawned the window.

The bug here was that when that client went away, the clipboard for
that window was broken.

If the mux server was the built-in mux in a gui process this could
leave a tab without working OSC 52 clipboard support.

This commit restructures things so that the Mux is responsible for
assigning a clipboard handler that rephrases the clipboard event
as a MuxNotification.

Both the GUI frontend and the mux server dispatcher already listen
for mux notifications and translate those events into appropriate
operations on the system clipboard or Pdus to send to the client(s).

refs: #1790
2022-03-31 09:55:51 -07:00
Wez Furlong
53c47143fd term: scope the conpty resize quirks better to conpty on windows
Previously, we'd just default the resize quirk on for all programs on
Windows.

That pessimizes the otherwise fine behavior of `wezterm ssh` or mux
connections to unixy platforms.

This commit moves the quirk out of the config trait and makes it
a runtime property of the terminal, and then arranges for it
to be set when we know that we set up a conpty for the terminal.

refs: #1265
2022-03-30 08:06:45 -07:00
Wez Furlong
3c701d9dc8 mux: propagate focus changes to remote mux
Pretty much the same test plan as b4c4c85683

but start wezterm:

./target/debug/wezterm -n --config 'ssh_domains={{name="s",remote_address="localhost"}}' connect s

This reliably propagates focus=true events, but if the client switches
focus away from a mux pane to a local pane, then the focus=false event
may not be propagated to the remote mux.

refs: #1608
2022-03-27 09:30:18 -07:00
Wez Furlong
4007ccbcd2 track focused pane in the client info
wezterm cli spawn, and wezterm cli split-pane can use this information
to pick a default for the pane id when invoked from outside of wezterm.

refs: https://github.com/wez/wezterm/issues/1531
2022-03-18 19:24:54 -07:00
Wez Furlong
22cea37959 deps: textwrap -> 0.15 2022-03-03 07:19:21 -07:00
Dixeran
9ba7ca1981
fix: tmux -CC capturep with extra \n (#1676)
fix: tmux capturep with extra \n
2022-03-01 06:18:25 -08:00
Wez Furlong
c4009d8e1d deps: shell-words -> 1.1.0 2022-02-06 18:32:10 -07:00
Wez Furlong
25b4b3ff87 ssh: use env when assume_shell=Posix
This allows us to send over COLORTERM and TERM_PROGRAM_XXX environment
that the SSH server would have denied via AcceptEnv rules.
2022-01-26 10:51:55 -07:00
Wez Furlong
a590955229 spawning a new tab didn't unfocus current pane
This commit centralizes the focus-loss logic to the Window so
that activating a new tab will deactivate the pane in the current
window.

Note that this cannot see overlays in the gui, but overlays shouldn't
care about focus, so it should be ok.

refs: https://github.com/wez/wezterm/discussions/796
2022-01-18 18:56:26 -07:00
Wez Furlong
0bf1b8d13e Plumbing for unseen activity indication
This commit enables the following config to work for local (not mux yet!)
panes:

```lua
local wezterm = require 'wezterm'

wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
  if tab.is_active then
    return {
      {Background={Color="blue"}},
      {Text=" " .. tab.active_pane.title .. " "},
    }
  end
  local has_unseen_output = false
  for _, pane in ipairs(tab.panes) do
    if pane.has_unseen_output then
      has_unseen_output = true
      break;
    end
  end
  if has_unseen_output then
    return {
      {Background={Color="Orange"}},
      {Text=" " .. tab.active_pane.title .. " "},
    }
  end
  return tab.active_pane.title
end)

return {
}
```

refs: https://github.com/wez/wezterm/discussions/796
2022-01-18 09:38:46 -07:00
Wez Furlong
e188406dfc make semantic zones more cacheable
This commit decomposes the main get_semantic_zones method into two
parts:

* A per-line portion, where the line ranges are cached (invalidated on
  change)
* The overall screen portion, where the line ranges are merged

This changes the overall complexity of computing zones from

   O(width * scrollback-height)

To an incremental:

   O((width * number of changed lines since last query) + scrollback-height)

You can see some samples of elapsed time below; those show the times for
running both the old and the new implementation on the same data.  The
number of lines/zones in the scrollback increases with each call and you
can see that the new implementation is a bit faster anyway at low
volumes but is significantly faster as the number of lines/zones
increases, because the amount of work is reduced.

```
get_semantic_zones: 71.708µs
get_semantic_zones_new: 59.041µs
get_semantic_zones: 71.166µs
get_semantic_zones_new: 9.166µs
get_semantic_zones: 44.291µs
get_semantic_zones_new: 4.208µs
get_semantic_zones: 69.791µs
get_semantic_zones_new: 10.291µs
get_semantic_zones: 59.375µs
get_semantic_zones_new: 7.958µs
get_semantic_zones: 52.5µs
get_semantic_zones_new: 4.5µs
get_semantic_zones: 91.791µs
get_semantic_zones_new: 20.916µs
get_semantic_zones: 229.916µs
get_semantic_zones_new: 109.208µs
get_semantic_zones: 224.125µs
get_semantic_zones_new: 15.208µs
get_semantic_zones: 291.791µs
get_semantic_zones_new: 11.833µs
get_semantic_zones: 238.875µs
get_semantic_zones_new: 12.625µs
get_semantic_zones: 468.458µs
get_semantic_zones_new: 126.583µs
get_semantic_zones: 460.5µs
get_semantic_zones_new: 25.666µs
get_semantic_zones: 358.291µs
get_semantic_zones_new: 19.541µs
get_semantic_zones: 436.833µs
get_semantic_zones_new: 17.875µs
get_semantic_zones: 313.166µs
get_semantic_zones_new: 15.25µs
get_semantic_zones: 333.958µs
get_semantic_zones_new: 16.541µs
get_semantic_zones: 364.666µs
get_semantic_zones_new: 14.041µs
 ```
2022-01-17 22:00:38 -07:00
Wez Furlong
ebef7dc659 tmux: when resizing locally, inform tmux of new size
This isn't really correct: if there are splits, this is most
likely going to do the wrong thing.

refs: #336
2022-01-17 16:55:41 -07:00
Wez Furlong
4ebbc6688d tmux: capture initial screen contents
refs: #1090
2022-01-17 14:36:57 -07:00
Wez Furlong
0eb1417c84 tmux: fix send-keys
Needs the % prefix to find the pane by id

refs: #1090
2022-01-17 14:20:05 -07:00
Wez Furlong
1c38c611f3 Split up some of the tmux state 2022-01-17 14:15:41 -07:00
Wez Furlong
e4ed2c93e2 encoding my preferred import grouping in the rustfmt config
This uses an unstable option in rustfmt, you `cargo +nightly fmt`
needs to be used to format the code correctly.
2022-01-17 13:50:51 -07:00
Wez Furlong
8f31aed3f1 move tmux-cc crate to be module inside termwiz
refs: #1090
2022-01-17 13:43:35 -07:00
Wez Furlong
db01691359 fix build
refs: #1090
2022-01-17 13:29:40 -07:00
g4c
9b7489ed97 buffer extra large message before write to mux 2022-01-17 13:08:41 -07:00
g4c
cf22db9b96 clean unwrap 2022-01-17 13:08:41 -07:00
g4c
1bdc952d9d fix log level 2022-01-17 13:08:41 -07:00
g4c
8ee5c295f7 doc and cleanup 2022-01-17 13:08:41 -07:00
g4c
6928415461 fix send-keys tmux command 2022-01-17 13:08:41 -07:00
dixeran
071aefc822 fix windows build 2022-01-17 13:08:41 -07:00