Protect a range of text in ScintillaNet: what is the best way to do it?

266 Views Asked by At

I know that styles have an attribute to allow/avoid changes in the text in which they are applied:

SCI_STYLESETCHANGEABLE(int style, bool changeable)

However, the documentation says "This is an experimental and incompletely implemented style attribute.", which seems it is not "production-ready"

I think there is another alternative, using "Indicators":

To protect a range of text, we could apply an specific indicator to it and in keydown event detect "del" & "backspace". If the character that follows current position (caret position) in "del" case or that precedes current position in "backspace" case has this indicator, then we must cancel the event and do not erase the text.

Which of this 2 alternatives is better? There is another better way?

Note: ScintillaNet is based on Scintilla and I assume that the extensive documentation of the last one is valid for both.

1

There are 1 best solutions below

0
On

I share with you one of the responses in "scintilla-interest" google-groups that published Neil Hodgson, the creator of Scintilla.

[Ian G.]> SCI_STYLESETCHANGEABLE is what I tried initially before I resorted to writing this patch. The only real disadvantage I can see is that in cases like my own it doubles the number of styles needed because every visual style that can occur in a writeable region can also occur in a protected region, but I could live with that.

[Neil Hodgson] It would be better to use an indicator for protected areas since they are relatively space efficient and avoid doubling the number of styles.

complete post in scintilla-interest