diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini
index f43c8f023..4b38d4d7f 100644
--- a/Build/Notepad3.ini
+++ b/Build/Notepad3.ini
@@ -42,6 +42,7 @@ SettingsVersion=4
;ExtendedWhiteSpaceChars=:
;AutoCompleteWordCharSet=
;AutoCompleteFillUpChars=
+;LineCommentPostfixStrg=
;UpdateDelayMarkAllOccurrences=50
;CurrentLineHorizontalSlop=40
;CurrentLineVerticalSlop=5
diff --git a/Versions/build.txt b/Versions/build.txt
index fb6bb0058..0c908bea1 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-2649
+2650
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index 483f91ffe..afb323bbc 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 BETA
diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp
index 235dd587b..773ee7b2f 100644
--- a/src/Config/Config.cpp
+++ b/src/Config/Config.cpp
@@ -804,6 +804,11 @@ void LoadSettings()
IniSectionGetString(Settings2_Section, L"AutoCompleteFillUpChars", Defaults2.AutoCompleteFillUpChars,
Settings2.AutoCompleteFillUpChars, COUNTOF(Settings2.AutoCompleteFillUpChars));
+ Defaults2.LineCommentPostfixStrg[0] = L'\0';
+ IniSectionGetString(Settings2_Section, L"LineCommentPostfixStrg", Defaults2.LineCommentPostfixStrg,
+ Settings2.LineCommentPostfixStrg, COUNTOF(Settings2.LineCommentPostfixStrg));
+ StrTrimW(Settings2.LineCommentPostfixStrg, L"\"");
+
StringCchCopyW(Defaults2.TimeStamp, COUNTOF(Defaults2.TimeStamp), L"\\$Date:[^\\$]+\\$ | $Date: %Y/%m/%d %H:%M:%S $");
IniSectionGetString(Settings2_Section, L"TimeStamp", Defaults2.TimeStamp, Settings2.TimeStamp, COUNTOF(Settings2.TimeStamp));
diff --git a/src/Edit.c b/src/Edit.c
index df06f5783..58612a45b 100644
--- a/src/Edit.c
+++ b/src/Edit.c
@@ -3183,11 +3183,21 @@ void EditToggleLineCommentsSimple(HWND hwnd, LPCWSTR pwszComment, bool bInsertAt
const DocPos iSelBegCol = SciCall_GetColumn(iSelStart);
- char mszComment[32 * 3] = { '\0' };
+
+ char mszPrefix[32 * 3] = { '\0' };
+ char mszPostfix[64 * 3] = { '\0' };
+ char mszComment[96 * 3] = { '\0' };
if (StrIsNotEmpty(pwszComment)) {
- WideCharToMultiByte(Encoding_SciCP, 0, pwszComment, -1, mszComment, COUNTOF(mszComment), NULL, NULL);
+ WideCharToMultiByte(Encoding_SciCP, 0, pwszComment, -1, mszPrefix, COUNTOF(mszPrefix), NULL, NULL);
+ if (StrIsNotEmpty(Settings2.LineCommentPostfixStrg)) {
+ WideCharToMultiByte(Encoding_SciCP, 0, Settings2.LineCommentPostfixStrg, -1, mszPostfix, COUNTOF(mszPostfix), NULL, NULL);
+ }
+ StringCchCopyA(mszComment, COUNTOF(mszComment), mszPrefix);
+ StringCchCatA(mszComment, COUNTOF(mszComment), mszPostfix);
}
+
+ DocPos const cchPrefix = (DocPos)StringCchLenA(mszPrefix, COUNTOF(mszPrefix));
DocPos const cchComment = (DocPos)StringCchLenA(mszComment, COUNTOF(mszComment));
if (cchComment == 0) { return; }
@@ -3231,7 +3241,7 @@ void EditToggleLineCommentsSimple(HWND hwnd, LPCWSTR pwszComment, bool bInsertAt
int iAction = 0;
- for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine)
+ for (DocLn iLine = iLineStart; iLine <= iLineEnd; ++iLine)
{
DocPos const iIndentPos = SciCall_GetLineIndentPosition(iLine);
@@ -3242,9 +3252,9 @@ void EditToggleLineCommentsSimple(HWND hwnd, LPCWSTR pwszComment, bool bInsertAt
}
const char* tchBuf = SciCall_GetRangePointer(iIndentPos, cchComment + 1);
- if (StrCmpNIA(tchBuf, mszComment, (int)cchComment) == 0)
+ if (StrCmpNA(tchBuf, mszComment, (int)cchComment) == 0)
{
- // remove comment chars
+ // remove comment chars incl. Postfix
DocPos const iSelPos = iIndentPos + cchComment;
switch (iAction) {
case 0:
@@ -3261,6 +3271,25 @@ void EditToggleLineCommentsSimple(HWND hwnd, LPCWSTR pwszComment, bool bInsertAt
break;
}
}
+ else if (StrCmpNA(tchBuf, mszPrefix, (int)cchPrefix) == 0)
+ {
+ // remove pure comment chars
+ DocPos const iSelPos = iIndentPos + cchPrefix;
+ switch (iAction) {
+ case 0:
+ iAction = 2;
+ case 2:
+ SciCall_SetTargetRange(iIndentPos, iSelPos);
+ SciCall_ReplaceTarget(0, "");
+ iSelEndOffset -= cchPrefix;
+ if (iLine == iLineStart) {
+ iSelStartOffset = (iSelStart == SciCall_PositionFromLine(iLine)) ? 0 : (0 - cchPrefix);
+ }
+ break;
+ case 1:
+ break;
+ }
+ }
else {
// set comment chars at indent pos
switch (iAction) {
diff --git a/src/TypeDefs.h b/src/TypeDefs.h
index 830422901..1182dd4a8 100644
--- a/src/TypeDefs.h
+++ b/src/TypeDefs.h
@@ -515,6 +515,7 @@ typedef struct _settings2_t
WCHAR FileBrowserPath[MAX_PATH];
WCHAR AppUserModelID[32];
WCHAR AutoCompleteFillUpChars[64];
+ WCHAR LineCommentPostfixStrg[64];
WCHAR ExtendedWhiteSpaceChars[ANSI_CHAR_BUFFER + 1];
WCHAR AutoCompleteWordCharSet[ANSI_CHAR_BUFFER + 1];
WCHAR TimeStamp[128];
diff --git a/src/Version.h b/src/Version.h
index e14858929..269b841be 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -74,7 +74,7 @@
#if defined(_MSC_VER)
#if (_MSC_VER == 1923)
#if(_MSC_FULL_VER >= 192328105)
- #define VER_CPL MS Visual C++ 2019 v16.3.0
+ #define VER_CPL MS Visual C++ 2019 v16.3.(0-1)
#endif
#elif (_MSC_VER == 1922)
#if(_MSC_FULL_VER >= 192227905)
diff --git a/src/VersionEx.h b/src/VersionEx.h
index b25f4081b..a0cce03d7 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 925
-#define VERSION_BUILD 2649
+#define VERSION_REV 926
+#define VERSION_BUILD 2650
#define SCINTILLA_VER 420
#define ONIGURUMA_REGEX_VER 6.9.3
#define UCHARDET_VER 2018.09.27