|
18 | 18 | #include "ScratchpadContent.h"
|
19 | 19 | #include "SnippetsPaneContent.h"
|
20 | 20 | #include "MarkdownPaneContent.h"
|
| 21 | +#include "TmuxControl.h" |
21 | 22 | #include "TabRowControl.h"
|
22 | 23 | #include "Remoting.h"
|
23 | 24 |
|
@@ -104,6 +105,11 @@ namespace winrt::TerminalApp::implementation
|
104 | 105 | }
|
105 | 106 | }
|
106 | 107 | _hostingHwnd = hwnd;
|
| 108 | + |
| 109 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 110 | + { |
| 111 | + _tmuxControl = std::make_unique<TmuxControl>(*this); |
| 112 | + } |
107 | 113 | return S_OK;
|
108 | 114 | }
|
109 | 115 |
|
@@ -238,6 +244,15 @@ namespace winrt::TerminalApp::implementation
|
238 | 244 | _newTabButton.Click([weakThis{ get_weak() }](auto&&, auto&&) {
|
239 | 245 | if (auto page{ weakThis.get() })
|
240 | 246 | {
|
| 247 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 248 | + { |
| 249 | + //Tmux control takes over |
| 250 | + if (page->_tmuxControl && page->_tmuxControl->TabIsTmuxControl(page->_GetFocusedTabImpl())) |
| 251 | + { |
| 252 | + return; |
| 253 | + } |
| 254 | + } |
| 255 | + |
241 | 256 | page->_OpenNewTerminalViaDropdown(NewTerminalArgs());
|
242 | 257 | }
|
243 | 258 | });
|
@@ -1203,6 +1218,15 @@ namespace winrt::TerminalApp::implementation
|
1203 | 1218 | }
|
1204 | 1219 | if (altPressed && !debugTap)
|
1205 | 1220 | {
|
| 1221 | + // tmux control panes don't share tab with other panes |
| 1222 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 1223 | + { |
| 1224 | + if (_tmuxControl && _tmuxControl->TabIsTmuxControl(_GetFocusedTabImpl())) |
| 1225 | + { |
| 1226 | + return; |
| 1227 | + } |
| 1228 | + } |
| 1229 | + |
1206 | 1230 | this->_SplitPane(_GetFocusedTabImpl(),
|
1207 | 1231 | SplitDirection::Automatic,
|
1208 | 1232 | 0.5f,
|
@@ -2241,6 +2265,15 @@ namespace winrt::TerminalApp::implementation
|
2241 | 2265 | return false;
|
2242 | 2266 | }
|
2243 | 2267 |
|
| 2268 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 2269 | + { |
| 2270 | + //Tmux control tab doesn't support to drag |
| 2271 | + if (_tmuxControl && _tmuxControl->TabIsTmuxControl(tab)) |
| 2272 | + { |
| 2273 | + return false; |
| 2274 | + } |
| 2275 | + } |
| 2276 | + |
2244 | 2277 | // If there was a windowId in the action, try to move it to the
|
2245 | 2278 | // specified window instead of moving it in our tab row.
|
2246 | 2279 | const auto windowId{ args.Window() };
|
@@ -3188,7 +3221,7 @@ namespace winrt::TerminalApp::implementation
|
3188 | 3221 | const auto tabViewItem = eventArgs.Tab();
|
3189 | 3222 | if (auto tab{ _GetTabByTabViewItem(tabViewItem) })
|
3190 | 3223 | {
|
3191 |
| - _HandleCloseTabRequested(tab); |
| 3224 | + tab.try_as<TabBase>()->CloseRequested.raise(nullptr, nullptr); |
3192 | 3225 | }
|
3193 | 3226 | }
|
3194 | 3227 |
|
@@ -3355,6 +3388,16 @@ namespace winrt::TerminalApp::implementation
|
3355 | 3388 | original->SetActive();
|
3356 | 3389 | }
|
3357 | 3390 |
|
| 3391 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 3392 | + { |
| 3393 | + if (profile.AllowTmuxControl() && _tmuxControl) |
| 3394 | + { |
| 3395 | + control.SetTmuxControlHandlerProducer([this, control](auto print) { |
| 3396 | + return _tmuxControl->TmuxControlHandlerProducer(control, print); |
| 3397 | + }); |
| 3398 | + } |
| 3399 | + } |
| 3400 | + |
3358 | 3401 | return resultPane;
|
3359 | 3402 | }
|
3360 | 3403 |
|
@@ -5242,6 +5285,14 @@ namespace winrt::TerminalApp::implementation
|
5242 | 5285 | tabImpl.copy_from(winrt::get_self<TabBase>(tabBase));
|
5243 | 5286 | if (tabImpl)
|
5244 | 5287 | {
|
| 5288 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 5289 | + { |
| 5290 | + //Tmux control tab doesn't support to drag |
| 5291 | + if (_tmuxControl && _tmuxControl->TabIsTmuxControl(tabImpl.try_as<TerminalTab>())) |
| 5292 | + { |
| 5293 | + return; |
| 5294 | + } |
| 5295 | + } |
5245 | 5296 | // First: stash the tab we started dragging.
|
5246 | 5297 | // We're going to be asked for this.
|
5247 | 5298 | _stashed.draggedTab = tabImpl;
|
|
0 commit comments