Skip to content
Snippets Groups Projects
Commit b86b94c6 authored by gambas's avatar gambas
Browse files

TextEditor: Take the mode into account when selecting a word.

[GB.FORM.EDITOR]
* BUG: TextEditor: Take the mode into account when selecting a word.
* BUG: TextEditor: Correctly define the identifier characters of the different modes.
parent cc5cba73
Branches
Tags
No related merge requests found
Pipeline #500330300 passed
[Component]
Key=gb.form.editor
Version=3.16.90
Version=3.17.90
Needs=Form
Requires=gb.eval.highlight,gb.util,gb.form
......@@ -2,7 +2,7 @@
Title=Text editor with syntax highlighting
Startup=FTestEditor
Icon=.hidden/control/texteditor.png
Version=3.16.90
Version=3.17.90
VersionFile=1
Component=gb.image
Component=gb.gui
......
......@@ -1200,14 +1200,10 @@ End
Private Sub IsWordChar(sCar As String) As Boolean
If IsSpace(sCar) Then Return
If IsPunct(sCar) And If InStr("_$", sCar) = 0 Then Return
If String.Code(sCar) = 160 Then Return
Return True
Return _Mode.IsIdentCar(sCar)
End
Public Sub WordLeft(X As Integer, Y As Integer, Optional bWord As Boolean) As Integer
Dim sLine As String = Lines[Y]
......
......@@ -44,7 +44,6 @@ Private Sub IsSpacePunctCar(sText As String, iPos As Integer) As Boolean
End
Public Sub InsideString(hEditor As TextEditor) As Boolean
Dim iLen As Integer
......
......@@ -3,3 +3,10 @@
Inherits TextEditorMode
Static Public Const STRING_DELIM As String = "\"'"
Public Sub IsIdentCar(sCar As String) As Boolean
If IsLetter(sCar) Or If IsDigit(sCar) Or If InStr("-_", sCar) Then Return True
End
......@@ -8,6 +8,12 @@ Static Public Const STRING_DELIM As String = "\"'"
Static Private $aDoNotClose As String[] = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]
Public Sub IsIdentCar(sCar As String) As Boolean
If IsLetter(sCar) Or If IsDigit(sCar) Or If InStr("-_", sCar) Then Return True
End
Private Sub InsertClosingMarkup(hEditor As TextEditor)
Dim sLine As String
......
......@@ -5,3 +5,10 @@ Inherits TextEditorMode
Static Public Const BRACES_OPEN As String = "([{"
Static Public Const BRACES_CLOSE As String = ")]}"
Static Public Const STRING_DELIM As String = "\"'`"
Public Sub IsIdentCar(sCar As String) As Boolean
If IsLetter(sCar) Or If IsDigit(sCar) Or If InStr("_$", sCar) Then Return True
End
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment