From 6eb4d02593d8c78a4685d2176efaef7f3070da51 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Mon, 23 Oct 2017 10:42:49 +0200 Subject: [PATCH] + fix: pasting clipboard content into selection box should replace text and cancel selection then (in case of swapping clipboard, the selection is preserved) --- src/Notepad3.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 20b28e04e..76fc41a01 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -3045,11 +3045,12 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam) SendMessage(hwndEdit,SCI_REPLACESEL,0,(LPARAM)pClip); - if (iCurrPos > iAnchor) - SendMessage(hwndEdit,SCI_SETSEL, iAnchor, iAnchor + lstrlenA(pClip)); - else - SendMessage(hwndEdit,SCI_SETSEL, iCurrPos + lstrlenA(pClip), iCurrPos); - + if (bSwapClipBoard) { + if (iCurrPos > iAnchor) + SendMessage(hwndEdit, SCI_SETSEL, iAnchor, iAnchor + lstrlenA(pClip)); + else + SendMessage(hwndEdit, SCI_SETSEL, iCurrPos + lstrlenA(pClip), iCurrPos); + } } EndSelUndoAction(token); LocalFree(pClip);