TextEditor: Make the automatic insertion of string delimiters more clever.
[GB.FORM.EDITOR] * NEW: TextEditor: Make the automatic insertion of string delimiters more clever.
This commit is contained in:
parent
6303762ff7
commit
3eaa0098d4
3 changed files with 11 additions and 50 deletions
|
@ -11,12 +11,12 @@ Private Sub Reload()
|
|||
' Next
|
||||
' System.Profile = True
|
||||
|
||||
'TextEditor1.Highlight = "gambas"
|
||||
TextEditor1.Mode = "gambas"
|
||||
'TextEditor1.Load("~/gambas/3.0/test/test-git/CHANGELOG", True)
|
||||
'TextEditor1.Load("~/gambas/git/master/comp/src/gb.form.editor/.src/TextEditor.class", True)
|
||||
TextEditor1.Load("~/gambas/git/master/comp/src/gb.form.editor/.src/TextEditor.class", True)
|
||||
'TextEditor1.Load("~/Fichier texte")
|
||||
TextEditor1.Mode = "C"
|
||||
TextEditor1.Load("~/gambas/git/master/main/lib/jit/gb.jit/gambas.h")
|
||||
'TextEditor1.Mode = "C"
|
||||
'TextEditor1.Load("~/gambas/git/master/main/lib/jit/gb.jit/gambas.h")
|
||||
'TextEditor1.Styles[Highlight.Custom].Background = Color.SetAlpha(Color.Red, 224)
|
||||
'TextEditor1.Styles[Highlight.Custom + 1].Background = Color.SetAlpha(Color.Green, 224)
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ Static Public Const ESCAPE_CHAR As String = "\\"
|
|||
|
||||
Public CloseBraces As Boolean
|
||||
Public InsideStringEscape As Boolean
|
||||
Public InsideStringDelim As String
|
||||
|
||||
Static Public Sub _init()
|
||||
|
||||
|
@ -43,7 +42,6 @@ Public Sub InsideString(hEditor As TextEditor) As Boolean
|
|||
Dim iCol As Integer
|
||||
|
||||
InsideStringEscape = False
|
||||
InsideStringDelim = ""
|
||||
|
||||
iCol = hEditor.Column
|
||||
If iCol = 0 Then Return
|
||||
|
@ -69,7 +67,13 @@ Public Sub InsideString(hEditor As TextEditor) As Boolean
|
|||
|
||||
Next
|
||||
|
||||
InsideStringDelim = sInside
|
||||
If sInside Then
|
||||
I = InStr(sLine, sInside, iCol + 1)
|
||||
If I = 0 Then
|
||||
InsideStringEscape = True
|
||||
Endif
|
||||
Endif
|
||||
|
||||
Return sInside
|
||||
|
||||
' If Not sInside Then Return
|
||||
|
@ -119,13 +123,6 @@ Public Sub CanCloseBraces(hEditor As TextEditor) As Boolean
|
|||
|
||||
If Not CloseBraces Then Return
|
||||
|
||||
' If InStr(Me.STRING_DELIM, Key.Text) Then
|
||||
' If InsideString(hEditor) Then
|
||||
' If InsideStringEscape Then Return False
|
||||
' Return Not InsideStringDelim
|
||||
' Endif
|
||||
' Endif
|
||||
|
||||
sLine = hEditor.Current.Text
|
||||
iLen = hEditor.Current.Length
|
||||
X = hEditor.Column
|
||||
|
|
|
@ -49,42 +49,6 @@ Private Sub ToggleAroundCurrentWord(hEditor As TextEditor, sBraces As String)
|
|||
|
||||
End
|
||||
|
||||
' Public Sub InsideString(hEditor As TextEditor) As Boolean
|
||||
'
|
||||
' Dim iLen As Integer
|
||||
' Dim I As Integer
|
||||
' Dim sInside As String
|
||||
' Dim sLine As String
|
||||
' Dim sCar As String
|
||||
'
|
||||
' sLine = hEditor.Current.Text
|
||||
' iLen = hEditor.Current.Length
|
||||
'
|
||||
' Me.InsideStringEscape = False
|
||||
' Me.InsideStringDelim = ""
|
||||
'
|
||||
' For I = 1 To hEditor.Column
|
||||
' sCar = String.Mid$(sLine, I, 1)
|
||||
' If sCar = sInside Then
|
||||
' sInside = ""
|
||||
' Else If InStr("'\"", sCar) Then
|
||||
' If Not sInside Then
|
||||
' sInside = sCar
|
||||
' If sCar = "'" Then Return True
|
||||
' Endif
|
||||
' Else If sCar = "\\" Then
|
||||
' If sInside Then
|
||||
' Inc I
|
||||
' Me.InsideStringEscape = I > hEditor.Column
|
||||
' Endif
|
||||
' Endif
|
||||
' Next
|
||||
'
|
||||
' Me.InsideStringDelim = sInside
|
||||
' Return sInside
|
||||
'
|
||||
' End
|
||||
|
||||
Public Sub OnKeyPress(hEditor As TextEditor) As Boolean
|
||||
|
||||
Dim sBraces As String
|
||||
|
|
Loading…
Reference in a new issue