Skip to content
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

Allow naming of the tabs #1705

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Allow naming of the tabs #1705

wants to merge 1 commit into from

Conversation

Yaraslaut
Copy link
Member

Refs #1690

PR Adds naming to the tabs, and adds another option to the Tabs status line config, separator

@github-actions github-actions bot added VT: Backend Virtual Terminal Backend (libterminal API) frontend Contour Terminal Emulator (GUI frontend) labels Jan 9, 2025
@@ -156,6 +157,7 @@ std::optional<StatusLineDefinitions::Item> makeStatusLineItem(
styles,
activeColor,
activeBackground,
std::nullopt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use designated initializers here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a comment, that this is separator, because this class has an inheritance and we can not use designated initialization here :(

@Yaraslaut Yaraslaut force-pushed the feature/tabs_naming branch 3 times, most recently from 6caa4ba to e0b350e Compare January 15, 2025 21:39
@Yaraslaut Yaraslaut force-pushed the feature/tabs_naming branch from e0b350e to 9469f71 Compare January 17, 2025 21:14
Copy link
Member

@christianparpart christianparpart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

"{SearchPrompt:Left= │ }"
"{TraceMode:Bold,Color=#FFFF00,Left= │ }"
"{ProtectedMode:Bold,Left= │ }" };
std::string middle { "{Title:Left= « ,Right= » }" };
std::string middle { "{Tabs: ActiveColor=#FFFF00}" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's figure out what this space is used for here :)

std::string const& Terminal::windowTitle() const noexcept
{
return _windowTitle;
}

void Terminal::setTabName()
{
inputHandler().setTabName([&](std::string name) { _tabName = name; });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
inputHandler().setTabName([&](std::string name) { _tabName = name; });
inputHandler().setTabName([&](std::string name) { _tabName = std::move(name); });

@@ -54,7 +53,10 @@ class TerminalSessionManager: public QAbstractListModel
display::TerminalDisplay* display = nullptr;
TerminalSession* getSession() { return _sessions[0]; }

void Update() { updateStatusLine(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void Update() { updateStatusLine(); }
void update() { updateStatusLine(); }

@@ -1562,11 +1562,26 @@ void Terminal::setWindowTitle(string_view title)
_eventListener.setWindowTitle(title);
}

void Terminal::setTabName(string_view title)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used. either remove, or at least accept title as std::string and then move ;it into _tabName :)

void setGuiTabInfoForStatusLine(TabsInfo&& info) { _guiTabInfoForStatusLine = std::move(info); }

TabsNamingMode getTabsNamingMode() const noexcept { return _settings.tabNamingMode; }
void setTabName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we maybe figure out a better name of it? Because setTabName sounds like you're setting a tab name, and you're usually also passing the name.

@@ -444,25 +457,26 @@ void ViInputHandler::startSearchExternally()

Handled ViInputHandler::handleSearchEditor(char32_t ch, Modifiers modifiers)
{
assert(_searchEditMode != SearchEditMode::Disabled);
assert(_searchEditMode != PromptMode::Disabled);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's see if we can find a way to not duplicate the input handling by "dependency injection", implementing the custom behavior through some common interface (search vs tab naming vs future-feature)

void setSearchModeSwitch(bool enabled);
void clearSearch();

private:
std::optional<std::function<void(std::string)>> _setTabNameCallback { std::nullopt };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move member variable declarations together (below)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Contour Terminal Emulator (GUI frontend) VT: Backend Virtual Terminal Backend (libterminal API)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants