Skip to content

Commit

Permalink
Code Editor: scroll and select (surge-synthesizer#7948)
Browse files Browse the repository at this point in the history
* Makes it possible to mousewheel scroll and select text at the same time.
* Shift + mousewheel scrolls sideways
  • Loading branch information
blancoberg authored Jan 3, 2025
1 parent 8f6c469 commit e001ec9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/surge-xt/gui/overlays/LuaEditors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,18 @@ void SurgeCodeEditorComponent::mouseWheelMove(const juce::MouseEvent &e,
{
juce::MouseWheelDetails w(wheel);
w.deltaY *= 4;
CodeEditorComponent::mouseWheelMove(e, w);

// makes it possible to mouse wheel scroll and select text at the same time
if (e.mods.isShiftDown())
{
auto scrollbar = dynamic_cast<juce::ScrollBar *>(getChildren()[1]);
auto pos = scrollbar->getCurrentRange().getStart();
scrollToColumn(pos - w.deltaY * 10);
}
else
{
scrollBy(-w.deltaY * 10);
}
}

// Handles auto indentation
Expand Down

0 comments on commit e001ec9

Please sign in to comment.