﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2874	_GUICtrlRichEdit_SetCharColor	mLipok	Jpm	"the same problem like HERE:
https://www.autoitscript.com/trac/autoit/ticket/2700

'''REPRO:'''
{{{
;~ http://www.autoitscript.com/forum/topic/161043-clear-way-to-show-lines-in-richedit-for-code-like-scite/

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include <GuiRichEdit.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate(""Form1"", 615, 438, 192, 124)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$sText = _
        ""ABCD"" & @CRLF & _
        ""EEEE"" & @CRLF & _
        ""AAAA"" & @CRLF & _
        """"

$hRichEdit = _GUICtrlRichEdit_Create($Form1, """", 100, 100, 150, 150)
_Magic($hRichEdit, $sText)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func _Magic(ByRef $hRichEdit, $sText)
    Local $aTextTemp = StringSplit($sText, @CRLF, 1)

    For $i = 1 To $aTextTemp[0]
        _GUICtrlRichEdit_SetSel($hRichEdit,-1,-1)
        Sleep(100) ; this can be removed
        _GUICtrlRichEdit_SetCharColor($hRichEdit, Dec(""00FF00""))
        Sleep(100); this can be removed
        _GUICtrlRichEdit_InsertText($hRichEdit, $i)
        Sleep(100); this can be removed
        _GUICtrlRichEdit_SetSel($hRichEdit,-1,-1)
        Sleep(100); this can be removed
        _GUICtrlRichEdit_SetCharColor($hRichEdit, Dec(""000000""))
        Sleep(100); this can be removed
        _GUICtrlRichEdit_InsertText($hRichEdit, "" "" & $aTextTemp[$i] & @CRLF)
        Sleep(100); this can be removed
    Next

EndFunc   ;==>_Magic
}}}

SOLUTION:
change this:

{{{
If $ai[0] = $ai[1] Then
	Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_ALL, $tCharFormat, 0, ""wparam"", ""struct*"") <> 0
Else
	Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_SELECTION, $tCharFormat, 0, ""wparam"", ""struct*"") <> 0
EndIf
}}}

to this:

{{{
	Return _SendMessage($hWnd, $EM_SETCHARFORMAT, $SCF_SELECTION, $tCharFormat, 0, ""wparam"", ""struct*"") <> 0

}}}
"	Bug	closed	3.3.13.20	Standard UDFs	3.3.10.2	None	Fixed		
