From 7233dba468f21f8524bd0476de8797a4fdcdb734 Mon Sep 17 00:00:00 2001 From: Fabien Bodard Date: Mon, 21 Mar 2016 08:22:40 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * NEW: Add an indentation level for .Begin/.End functions in the automatic code formater. git-svn-id: svn://localhost/gambas/trunk@7654 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.src/Editor/Code/MPrettyCode.module | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/gambas3/.src/Editor/Code/MPrettyCode.module b/app/src/gambas3/.src/Editor/Code/MPrettyCode.module index 2c9cc0083..cb56fdb04 100644 --- a/app/src/gambas3/.src/Editor/Code/MPrettyCode.module +++ b/app/src/gambas3/.src/Editor/Code/MPrettyCode.module @@ -210,10 +210,10 @@ Private Sub IndentLine(sLine As String) As String Dim sAdd As String Dim iNextLevel As Integer Dim sSym As String + Dim sFuncSym As String Dim iPos As Integer Dim iType As Integer Dim bLastWrap As Boolean - sLine = LTrim(sLine) If sLine Then @@ -263,6 +263,8 @@ Private Sub IndentLine(sLine As String) As String $bNeedNewLine = True Else sSym = aSym[0] + If aSym.Count > 2 Then sFuncSym = LCase(aSym[2]) + If sSym = "END" And If aSym.Count >= 2 Then sSym &= " " & aSym[1] If sSym = "DIM" Then @@ -290,6 +292,14 @@ Private Sub IndentLine(sLine As String) As String Else If sSym = "SELECT" Then $iLastSelect = $iLine iNextLevel = $iLevel + 2 + Else If sFuncSym = "end" Then 'Fabien : Add End function detecetion + Dec $iLevel + iNextLevel = $iLevel + If bLastWrap Then Inc $iLevel + Else If sFuncSym = "begin" Then 'Fabien : Add Begin function detection + iNextLevel = $iLevel + Inc iNextLevel + If bLastWrap Then Inc $iLevel Else If $cClose.Exist(sSym) Then Dec $iLevel iNextLevel = $iLevel