From cbaf98e0b93c6f121bb3fa56301782d9110e47ed Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Fri, 27 Sep 2019 11:29:14 +0200 Subject: [PATCH] + fix: Extended Toggle Line Comment Block should not select last line --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Edit.c | 12 +++++++++++- src/VersionEx.h | 4 ++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 1772c1858..7a54e98f6 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2653 +2654 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 4f18fa63d..793dceda2 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/src/Edit.c b/src/Edit.c index d13a55e16..2228cca0a 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -3243,8 +3243,9 @@ void EditToggleLineCommentsSimple(HWND hwnd, LPCWSTR pwszComment, bool bInsertAt const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + // don't consider (last) line where caret is before 1st column if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) { - if ((iLineEnd - iLineStart) >= 1) { + if ((iLineEnd - iLineStart) >= 1) { // except it is the only one --iLineEnd; } } @@ -3383,6 +3384,15 @@ void EditToggleLineCommentsExtended(HWND hwnd, LPCWSTR pwszComment, bool bInsert const DocLn iLineStart = SciCall_LineFromPosition(iSelStart); DocLn iLineEnd = SciCall_LineFromPosition(iSelEnd); + if (!Sci_IsMultiOrRectangleSelection()) { + // don't consider (last) line where caret is before 1st column + if (iSelEnd <= SciCall_PositionFromLine(iLineEnd)) { + if ((iLineEnd - iLineStart) >= 1) { // except it is the only one + --iLineEnd; + } + } + } + DocPos iCommentCol = 0; if (!bInsertAtStart) { diff --git a/src/VersionEx.h b/src/VersionEx.h index f0ce298f7..cc2abe7f6 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -7,8 +7,8 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 19 -#define VERSION_REV 926 -#define VERSION_BUILD 2653 +#define VERSION_REV 927 +#define VERSION_BUILD 2654 #define SCINTILLA_VER 420 #define ONIGURUMA_REGEX_VER 6.9.3 #define UCHARDET_VER 2018.09.27