From df438ea944c6ebcea2f8cd2b7277244044252664 Mon Sep 17 00:00:00 2001 From: Shridhar Kumar <45252729+shriprem@users.noreply.github.com> Date: Sat, 14 May 2022 16:08:39 -0400 Subject: [PATCH] Fix crash on "Copy Binary Content" command without selection on edit zone Fix also an issue that the word where the cursor is on in the edit zone is selected after running ABOUT box, that makes all the occurence of same word highlighted in the edit zone. Fix #11639, fix 11671, close #11673 --- PowerEditor/src/NppCommands.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 89e13dc69..4f886c8b2 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -373,7 +373,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_COPY_BINARY: case IDM_EDIT_CUT_BINARY: { - size_t textLen = _pEditView->execute(SCI_GETSELTEXT, 0, 0) - 1; + size_t textLen = _pEditView->execute(SCI_GETSELTEXT, 0, 0); if (!textLen) return; @@ -3160,8 +3160,8 @@ void Notepad_plus::command(int id) { bool doAboutDlg = false; const int maxSelLen = 32; - auto textLen = _pEditView->execute(SCI_GETSELTEXT, 0, 0) - 1; - if (!textLen) + auto textLen = _pEditView->execute(SCI_GETSELTEXT, 0, 0); + if (textLen <= 0) doAboutDlg = true; if (textLen > maxSelLen) doAboutDlg = true;