Code formatting now ignores void files, fixes in javascript compression.

[DEVELOPMENT ENVIRONMENT]
* BUG: Code formatting now ignores void files.
* NEW: Connection editor: Display the duration of custom requests is the request editor.
* NEW: Connection editor: The request editor now wraps its contents.
* BUG: Text editor: Some fixes in javascript compression.
This commit is contained in:
gambas 2019-03-07 14:56:03 +01:00
parent 0614a25525
commit 15641c109a
5 changed files with 33 additions and 10 deletions

View file

@ -110,6 +110,7 @@ Public Sub Run(hModule As Object)
$aSwitch = New Integer[]
aText = Split(hEditor.Text, "\n")
iEnd = Min(aText.Max, iEnd)
X = hEditor.Column
Y = hEditor.Line

View file

@ -675,6 +675,7 @@ Public Sub btnRunQuery_Click()
Dim sReq As String = Trim(edtRequest.Text)
Dim iPos As Integer
Dim sStart As String
Dim fTimer As Float
While Left(sReq, 2) = "/*"
iPos = InStr(sReq, "*/")
@ -684,6 +685,8 @@ Public Sub btnRunQuery_Click()
If Not sReq Then Return
fTimer = Timer
Inc Application.Busy
iPos = InStr(sReq, " ")
@ -701,7 +704,11 @@ Public Sub btnRunQuery_Click()
Dec Application.Busy
If Error Then Balloon.Error(("Unable to run query.") & "\n\n" & Error.Text, btnRunQuery)
If Error Then
Balloon.Error(("Unable to run query.") & "\n\n" & Error.Text, btnRunQuery)
Else
edtRequest.ShowMessageLabel(Subst(("&1 s"), Format(Timer - fTimer, "0.###")), Highlight.Highlight, True)
Endif
End

View file

@ -109,7 +109,7 @@
MoveScaled(1,1,106,72)
Expand = True
{ panTable Panel
MoveScaled(2,2,71,35)
MoveScaled(2,2,89,35)
Arrangement = Arrange.Fill
Spacing = True
{ tabTable TabPanel
@ -230,11 +230,11 @@
Index = 0
}
{ panRequest VBox
MoveScaled(6,8,61,24)
MoveScaled(6,9,80,24)
Visible = False
Background = Color.Background
{ tlbData2 ToolBar
MoveScaled(0,0,57,4)
MoveScaled(0,0,75,4)
Separator = True
{ btnRunQuery ToolButton
MoveScaled(0,0,12,4)
@ -291,6 +291,9 @@
ToolTip = ("Redo")
Picture = Picture["icon:/small/redo"]
}
{ Spring1 Spring
MoveScaled(58,1,5,2)
}
}
{ tabRequest TabPanel
MoveScaled(3,5,33,7)
@ -304,6 +307,8 @@
Expand = True
Border = False
Highlight = "SQL"
Mode = "SQL"
Wrap = True
}
}
}

View file

@ -2,7 +2,8 @@
Private Const IDENT_CAR As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$"
Private Const IDENT_CAR_CSS As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-.#"
Private Const SUBST_CAR As String = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Private Const SUBST_CAR_FIRST As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Private Const SUBST_CAR As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Private $aExt As String[] = ["js", "css", "html"]
@ -74,18 +75,22 @@ Private Sub SubstIdent(sIdent As String)
If $iDoNotCompress Then Return
If $cSubst.Exist(sIdent) Then Return
Repeat
Do
Inc $iSubst
iIndex = $iSubst
sSubst = ""
Repeat
sSubst = Mid$(SUBST_CAR, 1 + iIndex Mod Len(SUBST_CAR), 1) & sSubst
sSubst = Mid$(SUBST_CAR_FIRST, 1 + iIndex Mod Len(SUBST_CAR_FIRST), 1)
iIndex \= Len(SUBST_CAR_FIRST)
While iIndex
sSubst &= Mid$(SUBST_CAR, 1 + iIndex Mod Len(SUBST_CAR), 1) '& sSubst
iIndex \= Len(SUBST_CAR)
Until iIndex = 0
Wend
Until Not $cIdent.Exist(sSubst)
If Not $cIdent.Exist(sSubst) And If Not $cKeyword.Exist(sSubst) Then Break
Loop
$cSubst[sIdent] = sSubst
@ -349,7 +354,9 @@ Public Sub Javascript(sText As String) As String
Continue
Endif
Endif
sCar = " "
If InStr("=", Right(sCar2)) = 0 And If sLastKeyword <> "return" Then
If (Len(sRes) - iLastNewLine) > 76 Or If Mid$(sText, iPos + 1) Begins "function " Then
sRes &= "\n"
@ -359,6 +366,8 @@ Public Sub Javascript(sText As String) As String
If Right(sRes) = "}" And If IsLetter(Right(sCar2)) Then
sCar = "\n"
iLastNewLine = Len(sRes) + 1
Else If InStr("+-*/=", Right(sRes)) And If Right(sRes) = Right(sCar2) Then
' keep the space
Else
If InStr(IDENT_CAR, Right(sRes)) = 0 And If Right(sRes) <> "}" Then Continue
If InStr(IDENT_CAR, Right$(sCar2)) = 0 Then Continue

View file

@ -25,6 +25,7 @@
Border = False
Highlight = "Diff"
ReadOnly = True
Wrap = True
}
Index = 2
Text = ("Terminal")