TextArea - modified lines...

BlitzMax Forums/BlitzMax Programming/TextArea - modified lines...

MrCredo(Posted 2005) [#1]
I create a highlighter for my application.
Interesting is to have a function that return me which lines of code are changed...

for example: i select a block of code and then i paste other code from clipboard - how to get a range of lines that was modified?


MrCredo(Posted 2005) [#2]
a i found how to do this:

Repeat
	WaitEvent()
	Select EventID()
	Case EVENT_GADGETSELECT
		Select EventSource()
		Case editor
			editor_oldline=editor_curline
			editor_curline=TextAreaCursor(editor, TEXTAREA_LINES)
		EndSelect

	Case EVENT_GADGETACTION
		Select EventSource()
		Case editor
			highlighteditor (editor_oldline, editor_curline)
		EndSelect
		
	Case EVENT_WINDOWCLOSE
		Exit

	End Select
Forever



klepto2(Posted 2005) [#3]
I'm currently also writing a highlighter module, it is close to be finished. If your're interrested, here is a small demo :
http://www.brsoftware.de.vu/DL/ high.rar

I only have to insert the update of multiline commented areas if you hit enter or backspace within them or out of them.

The handling is very easy:

To initate the highlighter: High:THighlighter = Thighlighter.Create(TextArea)

Then you could load a Config file or add highlighted words manually.

And Finally you only have to do something like this in your main loop:

Select EventID()
        Case EVENT_WINDOWCLOSE
            End
            
        Case EVENT_GADGETACTION
            Select EventSource()
                Case Edit 
				High.Update()   
				tokens = High.GetTokens()          
				For Local Token:String = EachIn tokens
					Print Token
				Next
            End Select

        End Select



MrCredo(Posted 2005) [#4]
i needed this highlighter to highlight html-code

at the moment it highlight tags and strings... i do not need more

thx...

all works fine... my highlighter is very fast.