From 90f27dd1e11b81e2049a886d9be6c8d6ee76d40d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 24 May 2022 12:12:41 +0200 Subject: [PATCH] Pretty printer: A line with PRINT ending with a comma does not indent the next line. [DEVELOPMENT ENVIRONMENT] * BUG: Pretty printer: A line with PRINT ending with a comma does not indent the next line. --- .../.src/Editor/Code/MPrettyCode.module | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/gambas3/.src/Editor/Code/MPrettyCode.module b/app/src/gambas3/.src/Editor/Code/MPrettyCode.module index bc8715c90..5b5f2adf0 100644 --- a/app/src/gambas3/.src/Editor/Code/MPrettyCode.module +++ b/app/src/gambas3/.src/Editor/Code/MPrettyCode.module @@ -338,6 +338,7 @@ Private Sub IndentLineGambas(sLine As String) As String Dim iLastType As Integer Dim iLevel As Integer Dim bNextIndent As Boolean + Dim I As Integer sLine = LTrim(sLine) @@ -365,8 +366,23 @@ Private Sub IndentLineGambas(sLine As String) As String ' $bLastString = iLastType = Highlight.String If iLastType = Highlight.Operator Then - If InStr(":]);.!", aSym[aSym.Max]) = 0 Then 'And If aSym[0] <> "PRINT" Then + sSym = aSym.Last + If InStr(":]);.!", sSym) = 0 Then 'And If aSym[0] <> "PRINT" Then + $bNextIndent = True + + If sSym = "," Then + For I = aSym.Max - 1 DownTo 0 + sSym = aSym[I] + If sSym = "PRINT" Then + $bNextIndent = False + Break + Else If InStr("[(", sSym) Then + Break + Endif + Next + Endif + Endif Else If iLastType = Highlight.String And If Highlight.Types[0] = Highlight.String Then bNextIndent = True