Skip to content

Commit

Permalink
convert a rectangular selection into a multiple selection on arrow le…
Browse files Browse the repository at this point in the history
…ft/right or home/end

closes #323
  • Loading branch information
stefankueng committed Apr 19, 2023
1 parent 597af61 commit 9697e04
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ScintillaWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,20 @@ LRESULT CALLBACK CScintillaWnd::WinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wPara
break;
case WM_KEYDOWN:
{
switch (wParam)
{
case VK_RIGHT:
case VK_LEFT:
case VK_HOME:
case VK_END:
if (Scintilla().SelectionMode() != Scintilla::SelectionMode::Stream)
{
// change to stream mode: converts the rectangular into a multiple selection
Scintilla().SetSelectionMode(Scintilla::SelectionMode::Stream);
// set stream mode again: cancels selection mode, so moving won't extend the selection anymore
Scintilla().SetSelectionMode(Scintilla::SelectionMode::Stream);
}
}
auto ret = SendMessage(GetParent(*this), WM_SCICHAR, wParam, lParam);
if (ret == 0)
{
Expand Down Expand Up @@ -1493,7 +1507,7 @@ void CScintillaWnd::MarkSelectedWord(bool clear, bool edit)
if (selTextDifferent || (lastStopPosition != 0) || edit)
{
int addSelCount = 0;
auto start = std::chrono::steady_clock::now();
auto start = std::chrono::steady_clock::now();
if (selTextDifferent)
{
m_docScroll.Clear(DOCSCROLLTYPE_SELTEXT);
Expand Down

0 comments on commit 9697e04

Please sign in to comment.