Skip to content

Commit 598eb09

Browse files
Merge pull request #1739 from contour-terminal/fix/tabs_and_multiple_windows
Fix multiple windows and tabs support
2 parents 847b213 + a2aa73f commit 598eb09

File tree

12 files changed

+271
-83
lines changed

12 files changed

+271
-83
lines changed

.github/actions/spelling/allow/uncategorized.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,3 +1081,4 @@ ypixel
10811081
zsync
10821082
servicemenus
10831083
kio
1084+
bigobj

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ if(DEFINED MSVC)
3636
add_definitions(-DNOMINMAX)
3737
add_compile_options(/utf-8)
3838
add_compile_options(/nologo)
39+
add_compile_options(/bigobj)
3940
endif()
4041

4142

metainfo.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
<li>Fixes `CreateTab` to sometimes spawn more than one tab (#1695)</li>
114114
<li>Fixes crash using Chinese IME (#1707)</li>
115115
<li>Enables customizing predefined color palette (#1763)</li>
116+
<li>Fixes handling of multiple windows and tabs (#1725)</li>
116117
<li>Ensure inserting new tabs happens right next to the currently active tab (#1695)</li>
117118
<li>Allow glyphs to underflow if they are not bigger than the cell size (#1603)</li>
118119
<li>Adds `MoveTabToLeft` and `MoveTabToRight` actions to move tabs around (#1695)</li>

src/contour/ContourGuiApp.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ void ContourGuiApp::ensureTermInfoFile()
561561
void ContourGuiApp::newWindow()
562562
{
563563
_qmlEngine->load(resolveResource("ui/main.qml"));
564-
_sessionManager.display = _sessionManager.getSession()->display();
565564
}
566565

567566
void ContourGuiApp::showNotification(std::string_view title, std::string_view content)

src/contour/TerminalSession.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,9 @@ void TerminalSession::inspect()
606606
// Deferred termination? Then close display now.
607607
if (_terminal.device().isClosed() && !_app.dumpStateAtExit().has_value())
608608
{
609-
sessionLog()("Terminal device is closed. Closing display.");
610-
_display->closeDisplay();
609+
sessionLog()("Terminal device is closed. Notify session manager.");
610+
_manager->currentSessionIsTerminated();
611+
//_display->closeDisplay(); // TODO MOVE LOGIC
611612
}
612613
}
613614

@@ -680,8 +681,8 @@ void TerminalSession::onClosed()
680681
inspect();
681682
else if (_display)
682683
{
683-
sessionLog()("Terminal device is closed. Closing display.");
684-
_display->closeDisplay();
684+
sessionLog()("Terminal device is closed. Notify manager.");
685+
_manager->currentSessionIsTerminated();
685686
}
686687
else
687688
sessionLog()("Terminal device is closed. But no display available (yet).");
@@ -1494,6 +1495,7 @@ bool TerminalSession::operator()(actions::WriteScreen const& event)
14941495

14951496
bool TerminalSession::operator()(actions::CreateNewTab)
14961497
{
1498+
_manager->allowCreation();
14971499
_manager->createSession();
14981500
return true;
14991501
}
@@ -1644,6 +1646,8 @@ void TerminalSession::spawnNewTerminal(string const& profileName)
16441646
{
16451647
sessionLog()("spawning new in-process window");
16461648
_app.config().profile(_profileName)->shell.value().workingDirectory = fs::path(wd);
1649+
_manager->doNotSwitchToNewSession();
1650+
_manager->allowCreation();
16471651
_app.newWindow();
16481652
}
16491653
}

src/contour/TerminalSession.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ class TerminalSession: public QAbstractItemModel, public vtbackend::Terminal::Ev
249249
void attachDisplay(display::TerminalDisplay& display);
250250
void detachDisplay(display::TerminalDisplay& display);
251251

252+
TerminalSessionManager* getTerminalManager() const noexcept { return _manager; }
253+
252254
Q_INVOKABLE void applyPendingFontChange(bool allow, bool remember);
253255
Q_INVOKABLE void applyPendingPaste(bool allow, bool remember);
254256
Q_INVOKABLE void executePendingBufferCapture(bool allow, bool remember);

0 commit comments

Comments
 (0)