Skip to content

Fix multiple windows and tabs support #1739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/uncategorized.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1081,3 +1081,4 @@ ypixel
zsync
servicemenus
kio
bigobj
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ if(DEFINED MSVC)
add_definitions(-DNOMINMAX)
add_compile_options(/utf-8)
add_compile_options(/nologo)
add_compile_options(/bigobj)
endif()


Expand Down
1 change: 1 addition & 0 deletions metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
<li>Fixes `CreateTab` to sometimes spawn more than one tab (#1695)</li>
<li>Fixes crash using Chinese IME (#1707)</li>
<li>Enables customizing predefined color palette (#1763)</li>
<li>Fixes handling of multiple windows and tabs (#1725)</li>
<li>Ensure inserting new tabs happens right next to the currently active tab (#1695)</li>
<li>Allow glyphs to underflow if they are not bigger than the cell size (#1603)</li>
<li>Adds `MoveTabToLeft` and `MoveTabToRight` actions to move tabs around (#1695)</li>
Expand Down
1 change: 0 additions & 1 deletion src/contour/ContourGuiApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ void ContourGuiApp::ensureTermInfoFile()
void ContourGuiApp::newWindow()
{
_qmlEngine->load(resolveResource("ui/main.qml"));
_sessionManager.display = _sessionManager.getSession()->display();
}

void ContourGuiApp::showNotification(std::string_view title, std::string_view content)
Expand Down
12 changes: 8 additions & 4 deletions src/contour/TerminalSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,9 @@ void TerminalSession::inspect()
// Deferred termination? Then close display now.
if (_terminal.device().isClosed() && !_app.dumpStateAtExit().has_value())
{
sessionLog()("Terminal device is closed. Closing display.");
_display->closeDisplay();
sessionLog()("Terminal device is closed. Notify session manager.");
_manager->currentSessionIsTerminated();
//_display->closeDisplay(); // TODO MOVE LOGIC
}
}

Expand Down Expand Up @@ -680,8 +681,8 @@ void TerminalSession::onClosed()
inspect();
else if (_display)
{
sessionLog()("Terminal device is closed. Closing display.");
_display->closeDisplay();
sessionLog()("Terminal device is closed. Notify manager.");
_manager->currentSessionIsTerminated();
}
else
sessionLog()("Terminal device is closed. But no display available (yet).");
Expand Down Expand Up @@ -1494,6 +1495,7 @@ bool TerminalSession::operator()(actions::WriteScreen const& event)

bool TerminalSession::operator()(actions::CreateNewTab)
{
_manager->allowCreation();
_manager->createSession();
return true;
}
Expand Down Expand Up @@ -1644,6 +1646,8 @@ void TerminalSession::spawnNewTerminal(string const& profileName)
{
sessionLog()("spawning new in-process window");
_app.config().profile(_profileName)->shell.value().workingDirectory = fs::path(wd);
_manager->doNotSwitchToNewSession();
_manager->allowCreation();
_app.newWindow();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/contour/TerminalSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ class TerminalSession: public QAbstractItemModel, public vtbackend::Terminal::Ev
void attachDisplay(display::TerminalDisplay& display);
void detachDisplay(display::TerminalDisplay& display);

TerminalSessionManager* getTerminalManager() const noexcept { return _manager; }

Q_INVOKABLE void applyPendingFontChange(bool allow, bool remember);
Q_INVOKABLE void applyPendingPaste(bool allow, bool remember);
Q_INVOKABLE void executePendingBufferCapture(bool allow, bool remember);
Expand Down
Loading
Loading