Skip to content

Commit

Permalink
Add key binding disabled indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Jun 29, 2024
1 parent 4c71d0c commit 3ced4fb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<li>Add shell integration for bash shell.</li>
<li>Add better bell sound (#1378)</li>
<li>Add config entry to configure behaviour on exit from search mode</li>
<li>Add key bindings disabled indicator for status line (#783)</li>
<li>Update of contour.desktop file (#1423)</li>
<li>Fixes forwarding of input while in normal mode (#1468)</li>
<li>Fixes OSC-8 link id collision (#1499)</li>
Expand Down
11 changes: 10 additions & 1 deletion src/contour/TerminalSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ bool TerminalSession::operator()(actions::ScrollUp)

bool TerminalSession::operator()(actions::SearchReverse)
{
_terminal.inputHandler().startSearchExternally();
terminal().inputHandler().startSearchExternally();

return true;
}
Expand All @@ -1259,6 +1259,15 @@ bool TerminalSession::operator()(actions::ToggleAllKeyMaps)
{
_allowKeyMappings = !_allowKeyMappings;
inputLog()("{} key mappings.", _allowKeyMappings ? "Enabling" : "Disabling");

if (!_allowKeyMappings)
{
terminal().changeStatusLineDefinition(
parseStatusLineDefinition("{}", "{Text:text=key bindings disabled,Left= « ,Right= » }", "{}"));
terminal().setStatusDisplay(StatusDisplayType::Indicator);
}
else
terminal().resetStatusLineDefinition();
return true;
}

Expand Down
14 changes: 14 additions & 0 deletions src/vtbackend/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,20 @@ void Terminal::triggerWordWiseSelection(CellLocation startPos, TheSelectionHelpe
}
}

void Terminal::changeStatusLineDefinition(StatusLineDefinition&& definition)
{
_indicatorStatusLineDefinition = std::move(definition);
updateIndicatorStatusLine();
}

void Terminal::resetStatusLineDefinition()
{
_indicatorStatusLineDefinition = parseStatusLineDefinition(_settings.indicatorStatusLine.left,
_settings.indicatorStatusLine.middle,
_settings.indicatorStatusLine.right);
updateIndicatorStatusLine();
}

bool Terminal::handleMouseSelection(Modifiers modifiers)
{
verifyState();
Expand Down
3 changes: 3 additions & 0 deletions src/vtbackend/Terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ class Terminal

void triggerWordWiseSelectionWithCustomDelimiters(std::string const& delimiters);

void changeStatusLineDefinition(StatusLineDefinition && definition);
void resetStatusLineDefinition();

private:
void mainLoop();
void fillRenderBufferInternal(RenderBuffer& output, bool includeSelection);
Expand Down

0 comments on commit 3ced4fb

Please sign in to comment.