[DEVELOPMENT ENVIRONMENT]

* BUG: Fix task detection.
* NEW: When editing a WebPage, hitting ENTER or RETURN may automatically
  insert a closing "%>" if the cursor is inside a non-closed "<%". This 
  prevents unwanted syntax highlighting of HTML with Gambas syntax.


git-svn-id: svn://localhost/gambas/trunk@5105 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-08-31 18:02:36 +00:00
parent 62c4c78e22
commit 3d3b19cba5
4 changed files with 108 additions and 21 deletions

View file

@ -262,51 +262,51 @@ msgstr ""
msgid "Signals management"
msgstr ""
#: CComponent.class:136
#: CComponent.class:135
msgid "Video capture"
msgstr ""
#: CComponent.class:137
#: CComponent.class:136
msgid "Visual Basic compatibility"
msgstr ""
#: CComponent.class:138
#: CComponent.class:137
msgid "XML tools based on libxml"
msgstr ""
#: CComponent.class:139
#: CComponent.class:138
msgid "XML tools"
msgstr ""
#: CComponent.class:140
#: CComponent.class:139
msgid "HTML generator"
msgstr ""
#: CComponent.class:141
#: CComponent.class:140
msgid "XML-RPC protocol"
msgstr ""
#: CComponent.class:142
#: CComponent.class:141
msgid "XSLT tools based on libxslt and libxml"
msgstr ""
#: CComponent.class:143
#: CComponent.class:142
msgid "Web applications tools"
msgstr ""
#: CComponent.class:149 FPropertyComponent.form:126
#: CComponent.class:148 FPropertyComponent.form:126
msgid "Graphical form management"
msgstr ""
#: CComponent.class:150 FPropertyComponent.form:132
#: CComponent.class:149 FPropertyComponent.form:132
msgid "Event loop management"
msgstr ""
#: CComponent.class:152 FPropertyComponent.form:144
#: CComponent.class:151 FPropertyComponent.form:144
msgid "OpenGL display"
msgstr ""
#: CComponent.class:446
#: CComponent.class:445
msgid "Loading information on component &1..."
msgstr ""
@ -456,7 +456,7 @@ msgstr ""
#: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28
#: FSaveProjectAs.form:76 FSearch.class:859 FSelectExtraFile.form:43
#: FSelectIcon.form:86 FSnippet.form:57 FTableChooser.form:68 FText.form:41
#: FTextEditor.class:512 FTranslate.class:636 Project.module:430
#: FTextEditor.class:600 FTranslate.class:636 Project.module:430
msgid "Cancel"
msgstr ""
@ -1506,14 +1506,14 @@ msgstr ""
msgid "Procedure list"
msgstr ""
#: FEditor.class:2346 FIconEditor.class:2048 FTextEditor.class:512
#: FEditor.class:2346 FIconEditor.class:2048 FTextEditor.class:600
msgid ""
"The file has been modified.\n"
"\n"
"All your changes will be lost."
msgstr ""
#: FEditor.class:2772 FTextEditor.class:856
#: FEditor.class:2772 FTextEditor.class:944
msgid "(Declarations)"
msgstr ""
@ -4102,15 +4102,15 @@ msgstr ""
msgid "Uncompress file"
msgstr ""
#: FTextEditor.class:709
#: FTextEditor.class:797
msgid "The file has been compressed from &1 to &2 bytes (&3)."
msgstr ""
#: FTextEditor.class:709
#: FTextEditor.class:797
msgid "Original file has been saved in the <b>Project</b> folder."
msgstr ""
#: FTextEditor.class:715
#: FTextEditor.class:803
msgid "Unable to compress file."
msgstr ""

View file

@ -132,7 +132,6 @@ Static Private Sub InitComponentNames()
$cName["gb.sdl.sound"] = ("SDL sound & CD-ROM management")
$cName["gb.settings"] = ("Application settings management")
$cName["gb.signal"] = ("Signals management")
'$cName["gb.task"] = ("Background tasks management")
$cName["gb.v4l"] = ("Video capture")
$cName["gb.vb"] = ("Visual Basic compatibility")
$cName["gb.libxml"] = ("XML tools based on libxml")

View file

@ -51,7 +51,7 @@ Static Public Sub ScanFile(sPath As String) As CTask[]
sLine = Highlight.Purge(sLine, True)
iPos = InStr(sLine, "'")
If iPos Then
If Mid$(sLine, iPos, 1) = "'" Then Inc iPos
If Mid$(sLine, iPos + 1, 1) = "'" Then Inc iPos
sLine = Trim(Mid$(sLine, iPos + 1))
iPos = InStr(sLine, ":")
If iPos Then

View file

@ -47,6 +47,8 @@ Private $hBookmark As CBookmark
Private $cProc As Collection
Private $aProc As String[]
Private $bWebPage As Boolean
Public Sub _new(sPath As String, Optional bModule As Boolean)
Path = sPath
@ -75,6 +77,8 @@ Public Sub LoadFile() As Boolean
.Flags[Editor.HighlightBraces] = True
End With
$bWebPage = False
If $aExt.Exist(sExt) Then
Select Case sExt
@ -83,6 +87,7 @@ Public Sub LoadFile() As Boolean
$bShowCompress = Not Project.IsHiddenPath(Path)
Case "webpage"
edtEditor.Highlight = Highlight.WebPage
$bWebPage = True
Case "js"
edtEditor.Highlight = Highlight.JavaScript
$bShowCompress = Not Project.IsHiddenPath(Path)
@ -214,6 +219,75 @@ Public Sub Editors_Change()
End
Private Sub InAlternate() As Boolean
Dim sText As String = String.Left(Editor.Lines[Editor.Line].Text, Editor.Column)
Dim bAlt As Boolean
Dim I As Integer
Dim bQuote As Boolean
Dim sCar As String
Editor.Lines[Editor.Line].GetInitialState()
bAlt = Highlight.AlternateState
I = 1
While I <= String.Len(sText)
sCar = String.Mid$(sText, I, 1)
If bAlt Then
If bQuote Then
If sCar = "\\" Then
Inc I
Else If sCar = Chr$(34) Then
bQuote = False
Endif
Else
If sCar = Chr$(34) Then
bQuote = True
Else If String.Mid$(sText, I, 2) = "%>" Then
bAlt = False
Endif
Endif
Else
If String.Mid$(sText, I, 2) = "<%" Then
bAlt = True
Inc I
Endif
Endif
Inc I
Wend
Return bAlt
End
Private Sub FindCloseAlternate() As Boolean
Dim sLine As String
Dim I, J, A, B As Integer
I = Editor.Line
J = Editor.Column
While I < Editor.Lines.Count
sLine = Editor.Lines[I].Text
A = String.InStr(sLine, "<%", J + 1)
B = String.InStr(sLine, "%>", J + 1)
If B > 0 And If A = 0 Or A > B Then Return True
If A > 0 Then Return False
Inc I
J = 0
Wend
End
Public Sub Editors_KeyPress()
If Key.Code = Key.Escape Then
@ -260,7 +334,21 @@ Public Sub Editors_KeyPress()
' FMain.SearchProject
'
Endif
If Editor.ReadOnly Then Return
If Key.Code = Key.Return Or If Key.Code = Key.Enter Then
If Key.Normal Then
If $bWebPage Then
If InAlternate() And If Not FindCloseAlternate() Then
Editor.Insert("\n%>")
Editor.Goto(Editor.Line, 0)
Stop Event
Endif
Endif
Endif
Endif
End