Skip to content

Commit

Permalink
[vtbackend] Fixes selecting a single character not working easily (#1066
Browse files Browse the repository at this point in the history
)

Signed-off-by: Christian Parpart <christian@parpart.family>
  • Loading branch information
christianparpart committed Mar 31, 2023
1 parent 2d2e1c9 commit 5728aa9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<description>
<ul>
<li>Fixes terminfo `tsl` to how todays apps are using it (e.g. zsh) to simply set the window title.</li>
<li>Fixes selecting a single character not working easily (#1066).</li>
<li>Adds `profiles.*.permissions.display_host_writable_statusline` to allow the user to intervene in `DECSSDT` VT sequence to show the host writable statusline even if the indicator statusline is currently active.</li>
<li>Extends `ViNormalMode` to toggle between insert and normal mode rather than just entering normal mode.</li>
<li>Modal mode: Adds Return key to also move the cursor down (like vim).</li>
Expand Down
4 changes: 4 additions & 0 deletions src/vtbackend/InputGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,10 @@ bool InputGenerator::generateMouseMove(Modifier modifier,
PixelCoordinate pixelPosition,
bool uiHandled)
{
if (pos == _currentMousePosition && _mouseTransport != MouseTransport::SGRPixels)
// Only generate a mouse move event if the coordinate of interest(!) has actually changed.
return false;

auto const logged = [&](bool success) -> bool {
if (success)
{
Expand Down
2 changes: 0 additions & 2 deletions src/vtbackend/Selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ bool Selection::extend(CellLocation to)
{
assert(_state != State::Complete
&& "In order extend a selection, the selector must be active (started).");
if (_to == to)
return false;
_state = State::InProgress;
_to = to;
_onSelectionUpdated();
Expand Down
12 changes: 5 additions & 7 deletions src/vtbackend/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,11 @@ void Terminal::sendMouseMoveEvent(Modifier modifier,
clearSelection();
}

// Only continue if he mouse position has changed to a new grid value or we're tracking pixel values.
if (newPosition == _currentMousePosition && !isModeEnabled(DECMode::MouseSGRPixels))
return;

_currentMousePosition = newPosition;

updateCursorHoveringState();
if (newPosition != _currentMousePosition)
{
_currentMousePosition = newPosition;
updateCursorHoveringState();
}

if (!_leftMouseButtonPressed)
return;
Expand Down

0 comments on commit 5728aa9

Please sign in to comment.