From 507f2d2b3c00cbe867543195815ed7b6663b154f Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 14 Nov 2018 23:53:38 +0100 Subject: [PATCH] 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. --- .../src/gb.form.editor/.src/FTestEditor.class | 4 +- comp/src/gb.form.editor/.src/TextEditor.class | 40 +++++++++++++++---- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/comp/src/gb.form.editor/.src/FTestEditor.class b/comp/src/gb.form.editor/.src/FTestEditor.class index 15dcc7428..252f6fb27 100644 --- a/comp/src/gb.form.editor/.src/FTestEditor.class +++ b/comp/src/gb.form.editor/.src/FTestEditor.class @@ -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) diff --git a/comp/src/gb.form.editor/.src/TextEditor.class b/comp/src/gb.form.editor/.src/TextEditor.class index bf9969a44..fed634983 100644 --- a/comp/src/gb.form.editor/.src/TextEditor.class +++ b/comp/src/gb.form.editor/.src/TextEditor.class @@ -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