Hi,
I am trying to implement a track changes mechanism in my editor (like
the one in Visual Studio 2005).
Whenever a line is changed I add a marker on the margin indicating this
line was changed, if the file was saved, all marker a switched to green
markers.
This seems to work fine, however, it seems that adding the marker to the
editor messed the lexing of the document.
'Messing with the lexing' I mean that if I insert into the text a
comment block starter '/*' for example, the document is not colored to
green (as it should).
If i comment the below function 'AddTrackChangesMarker ' all works fine
If I add 'RedrawWindow()' after the call to 'AddTrackChangesMarker' all
works - but this is not the way to do it, (flickering, poor performance...)
My code:
In OnModified I capture the addtext, deletetext etc:
switch(pSCNotification->modificationType & (SC_MOD_INSERTTEXT |
SC_MOD_DELETETEXT))
{
case SC_MOD_INSERTTEXT:
{
// Text was added to document
int line = rCtrl.LineFromPosition(pSCNotification->position);
m_pEditor->AddTrackChangesMarker(line,
pSCNotification->linesAdded);
}
break;
:
:
The AddTrackChangesMarker is performing the following:
CScintillaCtrl &rCtrl = GetCtrl();
for(int start=startLine; start<=startLine+numberOfLines; start++)
{
// send the edit SCI_MARKERADD message
rCtrl.MarkerAdd(start, 2);
}
My definition of marker 2 is:
// Define marker yellow vertical line, SCI_MARKERDEFINEPIXMAP
rCtrl.MarkerDefinePixmap(2, (LPCTSTR)track_change_modified_xpm);
Any ideas?
Eran
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest