Discussion:
custom per line data
(too old to reply)
Nick Gravgaard
2014-08-10 22:19:35 UTC
Permalink
I would like to be able to have Scintilla store my own per line
data (an array of structs per line). This would mean I could
cache the lengths of text between tab characters and other
things I need without potentially having to rescan every line
in the file.



I thought one way to do this would be to have 2 new get and set
messages called SCI_GETCUSTOMLINEDATA(linenum) amd
SCI_SETCUSTOMLINEDATA(linenum, data). The data could be
anything but I would use them to store pointers to my arrays of
structs.



Neil, what do you think?
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-08-10 23:16:54 UTC
Permalink
I would like to be able to have Scintilla store my own per line data (an array of structs per line). This would mean I could cache the lengths of text between tab characters and other things I need without potentially having to rescan every line in the file.
You should be able to use similar code to that in Scintilla (such as PerLine's InsertLine/RemoveLine) for maintaining per-line data structures in your application. Trigger on the SCN_MODIFIED notification when linesAdded is non-0.

The difficulty in maintaining per-line data is not in moving lines because of insertion/deletion but in managing the lifetime of lines that are inserted or removed and their relationship to other lines. Your application will have to decide on the value for each newly inserted line (empty may work for your case but that is not all cases) and there would also have to be a way to safely free deleted lines particularly if they also contain pointers. Then there are issues about which line is new/old when a line end is inserted or removed, merging 2 lines.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
i***@gmail.com
2014-08-11 08:07:19 UTC
Permalink
Loading...