Fix Python smart indent wrongly when comment line ends in colon

Fix #15528, close #15529
This commit is contained in:
Alan Kilborn 2024-08-09 08:22:53 -04:00 committed by Don Ho
parent 72751182bf
commit 48a2b30c13
1 changed files with 2 additions and 1 deletions

View File

@ -3768,7 +3768,8 @@ void Notepad_plus::maintainIndentation(wchar_t ch)
auto endPos = _pEditView->execute(SCI_GETLINEENDPOSITION, prevLine);
_pEditView->execute(SCI_SETTARGETRANGE, startPos, endPos);
const char colonExpr[] = ":[ \t]*(#|$)"; // colon optionally followed by only whitespace and/or start-of-comment
// colon optionally followed by only whitespace and/or start-of-comment, but NOT on a line that is already a comment
const char colonExpr[] = "^[^#]*\\K:[ \t]*(#|$)";
if (_pEditView->execute(SCI_SEARCHINTARGET, strlen(colonExpr), reinterpret_cast<LPARAM>(colonExpr)) >= 0)
{