Position indicators; possible?

20 views
Skip to first unread message

Paul K

unread,
Oct 28, 2015, 12:32:58 PM10/28/15
to scintilla-interest
Hi Neil,

I sometimes need to have position indicators (for example, to mark positions where the search starts and ends). I'd like to use indicators for that, but they all require non-zero length, which makes them wrap 1 or more characters and I'd prefer for them to go *between* characters. I tried to use INDIC_BOX to draw a vertical line, but it doesn't take zero length.

Would it make sense to add an indicator that is simply a vertical line (maybe with a small dot?) or allow INDIC_BOX to take zero as length and draw only its vertical side? Maybe there is already something like this and I missed it?

Paul.

Neil Hodgson

unread,
Oct 28, 2015, 6:42:19 PM10/28/15
to scintilla...@googlegroups.com
Paul K:

> Would it make sense to add an indicator that is simply a vertical line (maybe with a small dot?) or allow INDIC_BOX to take zero as length and draw only its vertical side?

Single position (zero-width) indicators would be an excellent addition. They would be useful for showing where deletions have occurred and for marking insertion points in snippets. They could use various vertical bars or bar segments, dotted or continuous, and there could also be marks similar to ‘^’ carets either below or above the text.

The data structure used for indicators is not a good match for this since it removes any indicators that become empty. While it could be extended to allow indicators to have an ‘allow empty’ option, this may complicate the current code and lead to regressions for current indicators.

Any implementation of single position indicators should be similar to current indicators. It should be implemented using a sparse format (memory use expands linearly with number of indicators, not number of characters in document), finding indicators in a range should be of logarithmic complexity and insertion and deletion of text should have amortised below linear (relative to #indicators) complexity.

Neil

Reply all
Reply to author
Forward
0 new messages