Skip to content

Commit

Permalink
1.6.2 update
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSquires committed May 27, 2018
1 parent b83b303 commit 60ff8e9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 30 deletions.
Binary file modified WinFBE.wfbe
Binary file not shown.
Binary file modified WinFBE32.exe
Binary file not shown.
Binary file modified WinFBE64.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Version 1.6.2 (May 27, 2018)
- Fixed: Conflicting issue with AutoComplete and AutoIndent config flags.

Version 1.6.1 (May 26, 2018)
- Added: Help/About now shows if running 32 or 64 bit version of WinFBE.
- Fixed: Explorer treeview and popup Function List were not displaying SUB routines.
Expand Down
2 changes: 1 addition & 1 deletion src/WinFBE.bas
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Using Afx

#Define APPNAME WStr("WinFBE - FreeBASIC Editor")
#Define APPNAMESHORT WStr("WinFBE")
#Define APPVERSION WStr("1.6.1")
#Define APPVERSION WStr("1.6.2")

#ifdef __FB_64BIT__
#Define APPBITS WStr(" (64-bit)")
Expand Down
67 changes: 38 additions & 29 deletions src/modAutoInsert.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function CanCompleteBlockStatement( byval pDoc as clsDocument ptr, _
byval idBlockType as long, _
byval nStartLine as long _
) as boolean
If gConfig.AutoComplete = false Then return false
dim as long NumLines, nLenMatch
dim as string sStartMatch, sEndMatch, sLine
Expand Down Expand Up @@ -104,7 +107,9 @@ end function
''
''
function AttemptAutoInsert() as Long
If gConfig.AutoComplete = false Then exit function
' Attempts to Autocomplete a FOR/DO/SELECT, etc block. This function also deals
' with AutoIndentation so need to handle both separation depending on the user
' chosen settings.
Dim as HWND hEdit
Dim as long nLine, curPos, LineLen, nFoldLevel, TabSize, nSpaces, IndentSize, i
Expand Down Expand Up @@ -142,6 +147,10 @@ function AttemptAutoInsert() as Long
Next
strPrevLine = Trim(Ucase(strPrevLine), Any Chr(32, 9))

If gConfig.AutoIndentation = false Then
nSpaces = 0: IndentSize = 0: TabSize = 0
END IF

''''''''''
' IF/THEN
' Before autoindenting an IF statement make sure that this
Expand All @@ -151,9 +160,9 @@ function AttemptAutoInsert() as Long
' once we have wrapped it in an END IF. It will include any chunk of
' text that was after the THEN in a single line IF/THEN
SciExec(hEdit, SCI_LINEDELETE, 0, 0)
strFill = Space(nSpaces + IndentSize) & ltrim(strCurline, any chr(32,9)) & vbcrlf
strFill = Space(nSpaces + IndentSize) & ltrim(strCurline, any chr(32,9))
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_IF, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END IF") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END IF") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -164,9 +173,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' FOR/NEXT
If Left(strPrevLine, 4) = "FOR " then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_FOR, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("NEXT") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("NEXT") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -177,9 +186,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' SELECT CASE
If Left(strPrevLine, 12) = "SELECT CASE " then
strFill = Space(nSpaces + IndentSize) & "CASE " & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_SELECT, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END SELECT") & vbcrlf
strFill = strFill & "CASE " & vbcrlf & SPACE(nSpaces) & ConvertCase("END SELECT") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize + 5
Expand All @@ -190,9 +199,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' WHILE/WEND
If (Left(strPrevLine, 6) = "WHILE ") or (strPrevLine = "WHILE") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_WHILE, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("WEND") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("WEND") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -203,9 +212,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' DO/LOOP
If (Left(strPrevLine, 3) = "DO ") or (strPrevLine = "DO") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_DO, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("LOOP") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("LOOP") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -223,9 +232,9 @@ function AttemptAutoInsert() as Long
i = instr(strTemp, "(")
if i then strTemp = left(strTemp, i-1)
if instr(strTemp, "=") then exit function
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_FUNCTION, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END FUNCTION") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END FUNCTION") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -238,9 +247,9 @@ function AttemptAutoInsert() as Long
If (Left(strPrevLine, 4) = "SUB ") or _
(Left(strPrevLine, 12) = "PRIVATE SUB ") or _
(Left(strPrevLine, 11) = "PUBLIC SUB") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_SUB, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END SUB") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END SUB") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -251,9 +260,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' PROPERTY/END PROPERTY
If (Left(strPrevLine, 9) = "PROPERTY ") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_SUB, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END PROPERTY") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END PROPERTY") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -264,9 +273,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' CONSTRUCTOR/END CONSTRUCTOR
If (Left(strPrevLine, 12) = "CONSTRUCTOR ") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_CONSTRUCTOR, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END CONSTRUCTOR") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END CONSTRUCTOR") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -277,9 +286,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' DESTRUCTOR/END DESTRUCTOR
If (Left(strPrevLine, 11) = "DESTRUCTOR ") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_DESTRUCTOR, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END DESTRUCTOR") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END DESTRUCTOR") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -292,9 +301,9 @@ function AttemptAutoInsert() as Long
If (Left(strPrevLine, 5) = "TYPE ") then
' Determine if this is a TYPE = statement rather than a true TYPE structure
if instr(ucase(strPrevLine), " AS ") then exit function
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_TYPE, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END TYPE") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END TYPE") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -305,9 +314,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' WITH/END WITH
If (Left(strPrevLine, 4) = "WITH") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_WITH, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END WITH") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END WITH") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -318,9 +327,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' ENUM/END ENUM
If (Left(strPrevLine, 4) = "ENUM") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_ENUM, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END ENUM") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END ENUM") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand All @@ -331,9 +340,9 @@ function AttemptAutoInsert() as Long
'''''''''''''
' UNION/END UNION
If (Left(strPrevLine, 6) = "UNION ") then
strFill = Space(nSpaces + IndentSize) & vbcrlf
strFill = Space(nSpaces + IndentSize)
if CanCompleteBlockStatement(pDoc, BLOCK_STATEMENT_UNION, nLine) then
strFill = strFill & SPACE(nSpaces) & ConvertCase("END UNION") & vbcrlf
strFill = strFill & vbcrlf & SPACE(nSpaces) & ConvertCase("END UNION") & vbcrlf
end if
SciExec(hEdit, SCI_ADDTEXT, Len(strFill), Strptr(strFill))
curPos = curPos + nSpaces + IndentSize
Expand Down

0 comments on commit 60ff8e9

Please sign in to comment.