TextEditor: Try to make automatic insertion of quotes more clever.

[GB.FORM.EDITOR]
* NEW: TextEditor: Try to make automatic insertion of quotes more clever.
This commit is contained in:
gambas 2018-09-29 04:42:42 +02:00
parent aa6b7825d8
commit 35d20604b1

View file

@ -49,41 +49,41 @@ 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 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