From 46a798deecf8aae84868b85d618c2806a42423f7 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 20 Apr 2021 10:14:37 +0200 Subject: [PATCH] + fix: copy multi-selection to clipboard: separate each match by line-break --- src/Edit.c | 21 +++++++++++++++++++++ src/Edit.h | 1 + src/Notepad3.c | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Edit.c b/src/Edit.c index b02b84bbe..4e2f508f4 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -2851,6 +2851,27 @@ void EditCutLines(HWND hwnd) { } +//============================================================================= +// +// EditCopyMultiSelection() +// +void EditCopyMultiSelection(HWND hwnd) { + + if (SciCall_IsSelectionEmpty()) { + return; + } + if (Sci_IsMultiSelection()) { + EditClearClipboard(hwnd); + DocPosU const selCount = SciCall_GetSelections(); + for (DocPosU s = 0; s < selCount; ++s) { + EditCopyRangeAppend(hwnd, SciCall_GetSelectionNStart(s), SciCall_GetSelectionNEnd(s), true); + } + } else { + SciCall_Copy(); + } +} + + //============================================================================= // // EditModifyLines() diff --git a/src/Edit.h b/src/Edit.h index 52130bacf..73540e0ce 100644 --- a/src/Edit.h +++ b/src/Edit.h @@ -66,6 +66,7 @@ void EditMoveDown(HWND hwnd); bool EditSetCaretToSelectionStart(); bool EditSetCaretToSelectionEnd(); void EditCutLines(HWND hwnd); +void EditCopyMultiSelection(HWND hwnd); void EditModifyLines(LPCWSTR pwszPrefix, LPCWSTR pwszAppend); void EditIndentBlock(HWND hwnd,int cmd, bool bFormatIndentation, bool bForceAll); void EditAlignText(int nMode); diff --git a/src/Notepad3.c b/src/Notepad3.c index 7707f382f..3a7eecef5 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -4393,7 +4393,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) } } } else { - SciCall_Copy(); + EditCopyMultiSelection(Globals.hwndEdit); } } break;