TextEditor: Syntax highlihgting of lines including tab characters has been fixed.

[GB.FORM.EDITOR]
* BUG: TextEditor: Syntax highlihgting of lines including tab characters has been fixed.
This commit is contained in:
gambas 2018-11-14 23:53:38 +01:00
parent f30edfa302
commit 507f2d2b3c
2 changed files with 35 additions and 9 deletions

View file

@ -13,8 +13,10 @@ Private Sub Reload()
'TextEditor1.Highlight = "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.Styles[Highlight.Custom].Background = Color.SetAlpha(Color.Red, 224)
'TextEditor1.Styles[Highlight.Custom + 1].Background = Color.SetAlpha(Color.Green, 224)

View file

@ -653,14 +653,7 @@ Private Sub DrawHighlightedText(Row As Integer, sText As String, aColor As Byte[
'If hStyle.Bold Then Paint.Font = $hFontBold
If InStr(sStr, "\t") Then
iCol = hStyle.Color
Paint.Background = iCol
If hStyle.Bold Then
'Paint.Background = Color.Gradient(iCol, $iBackground)
DrawText(sStr, X, XX + 1, YY)
Endif
'Paint.Background = iCol
DrawText(sStr, X, XX, YY)
GoSub DRAW_TEXT_WITH_TAB
Else If Trim(sStr) Then
If Not $bRemoteDisplay And If iLen <= 16 Then
sKey = Chr$(iState) & sStr
@ -763,6 +756,37 @@ DRAW_TEXT:
Return
DRAW_TEXT_WITH_TAB:
iCol = hStyle.Color
Paint.Background = iCol
If hStyle.Bold Then
LB = $BW
XB = 0
While LB >= 2
'Paint.DrawText(sStr, XB, YY + $iAscent) 'DrawText(sStr, SX, X + 1, Y)
DrawText(sStr, X + XB, XX + XB, YY)
Inc XB
LB -= 2
Wend
If LB Then
Paint.Background = Color.SetAlpha(iCol, 128)
'Paint.DrawText(sStr, XB, YY + $iAscent) 'DrawText(sStr, SX, X + 1, Y)
DrawText(sStr, X + XB, XX + XB, YY)
Endif
Else
'Paint.DrawText(sStr, XX, YY + $iAscent) 'DrawText(sStr, SX, X, Y)
DrawText(sStr, X, XX, YY)
Endif
' If hStyle.Bold Then
' 'Paint.Background = Color.Gradient(iCol, $iBackground)
' DrawText(sStr, X, XX + 1, YY)
' Endif
' 'Paint.Background = iCol
' DrawText(sStr, X, XX, YY)
Return
End
Private Sub GetTabSizeAround(Row As Integer) As Integer