|
23 | 23 | #include "SnippetsPaneContent.h" |
24 | 24 | #include "TabRowControl.h" |
25 | 25 | #include "TerminalSettingsCache.h" |
| 26 | +#include "TmuxControl.h" |
26 | 27 |
|
27 | 28 | #include "LaunchPositionRequest.g.cpp" |
28 | 29 | #include "RenameWindowRequestedArgs.g.cpp" |
@@ -406,6 +407,15 @@ namespace winrt::TerminalApp::implementation |
406 | 407 | TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), |
407 | 408 | TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage)); |
408 | 409 |
|
| 410 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 411 | + { |
| 412 | + // tmux control takes over |
| 413 | + if (page->_tmuxControl && page->_tmuxControl->TabIsTmuxControl(page->_GetFocusedTabImpl())) |
| 414 | + { |
| 415 | + return; |
| 416 | + } |
| 417 | + } |
| 418 | + |
409 | 419 | page->_OpenNewTerminalViaDropdown(NewTerminalArgs()); |
410 | 420 | } |
411 | 421 | }); |
@@ -1431,6 +1441,15 @@ namespace winrt::TerminalApp::implementation |
1431 | 1441 | } |
1432 | 1442 | if (altPressed && !debugTap) |
1433 | 1443 | { |
| 1444 | + // tmux control panes don't share tab with other panes |
| 1445 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 1446 | + { |
| 1447 | + if (_tmuxControl && _tmuxControl->TabIsTmuxControl(_GetFocusedTabImpl())) |
| 1448 | + { |
| 1449 | + return; |
| 1450 | + } |
| 1451 | + } |
| 1452 | + |
1434 | 1453 | this->_SplitPane(_GetFocusedTabImpl(), |
1435 | 1454 | SplitDirection::Automatic, |
1436 | 1455 | 0.5f, |
@@ -2527,6 +2546,15 @@ namespace winrt::TerminalApp::implementation |
2527 | 2546 | return false; |
2528 | 2547 | } |
2529 | 2548 |
|
| 2549 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 2550 | + { |
| 2551 | + //Tmux control tab doesn't support to drag |
| 2552 | + if (_tmuxControl && _tmuxControl->TabIsTmuxControl(tab)) |
| 2553 | + { |
| 2554 | + return false; |
| 2555 | + } |
| 2556 | + } |
| 2557 | + |
2530 | 2558 | // If there was a windowId in the action, try to move it to the |
2531 | 2559 | // specified window instead of moving it in our tab row. |
2532 | 2560 | const auto windowId{ args.Window() }; |
@@ -3595,6 +3623,26 @@ namespace winrt::TerminalApp::implementation |
3595 | 3623 | original->SetActive(); |
3596 | 3624 | } |
3597 | 3625 |
|
| 3626 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 3627 | + { |
| 3628 | + if (!_tmuxControl) |
| 3629 | + { |
| 3630 | + _tmuxControl = std::make_shared<TmuxControl>(*this); |
| 3631 | + } |
| 3632 | + |
| 3633 | + control.EnterTmuxControl([tmuxControl = _tmuxControl.get()](auto&& sender, auto&& args) { |
| 3634 | + if (auto control = sender.try_as<TermControl>()) |
| 3635 | + { |
| 3636 | + if (tmuxControl->AcquireSingleUseLock(std::move(control))) |
| 3637 | + { |
| 3638 | + args.InputCallback([tmuxControl](auto&& str) { |
| 3639 | + tmuxControl->FeedInput(winrt_array_to_wstring_view(str)); |
| 3640 | + }); |
| 3641 | + } |
| 3642 | + } |
| 3643 | + }); |
| 3644 | + } |
| 3645 | + |
3598 | 3646 | return resultPane; |
3599 | 3647 | } |
3600 | 3648 |
|
@@ -5500,6 +5548,15 @@ namespace winrt::TerminalApp::implementation |
5500 | 5548 | tabImpl.copy_from(winrt::get_self<Tab>(tabBase)); |
5501 | 5549 | if (tabImpl) |
5502 | 5550 | { |
| 5551 | + if constexpr (Feature_TmuxControl::IsEnabled()) |
| 5552 | + { |
| 5553 | + //Tmux control tab doesn't support to drag |
| 5554 | + if (_tmuxControl && _tmuxControl->TabIsTmuxControl(tabImpl)) |
| 5555 | + { |
| 5556 | + return; |
| 5557 | + } |
| 5558 | + } |
| 5559 | + |
5503 | 5560 | // First: stash the tab we started dragging. |
5504 | 5561 | // We're going to be asked for this. |
5505 | 5562 | _stashed.draggedTab = tabImpl; |
|
0 commit comments