Skip to content

Commit

Permalink
Fix Python smart indent wrongly when comment line ends in colon
Browse files Browse the repository at this point in the history
  • Loading branch information
alankilborn authored and donho committed Aug 9, 2024
1 parent 7275118 commit 48a2b30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion PowerEditor/src/Notepad_plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 48a2b30

Please sign in to comment.