i***@gmail.com
2014-07-23 09:18:32 UTC
I have implemented SC_MOD_DELETECHECK and SCI_CHANGEDELETION as
counterparts to SC_MOD_INSERTCHECK and SCI_CHANGEINSERTION in my own copy
of Scintilla. I would like to submit a patch if there is interest.
My motivation was to allow vetoing of changes to certain parts of the
document; SC_MOD_INSERTCHECK makes this possible for text insertion but I
also needed a similar method for text deletion. I originally tried to use
the SCI_STYLESETCHANGEABLE style attribute, but this has a number of
limitations that made it unsuitable for my use case â the most significant
being that it is not permitted to place the caret or make a selection in an
unchangeable region.
To veto an insertion it is just a matter of calling SCI_CHANGEINSERTION
with a length of zero and an empty string. I did have to modify the
implementation slightly so that such null-insertions don't cause an empty
undo action to be stored and the document potentially to leave its
save-point.
SCI_CHANGEDELETION allows the caller to modify the position and length of
the region being deleted. Setting the length to zero vetoes the deletion.
One of the original use-cases described by Neil for
SC_MOD_INSERTCHECK/SCI_CHANGEINSERTION was to replace certain Unicode
characters with equivalent character sequences, e.g. the n-dash character
with – in HTML. My changes extend this use case such that deleting a
single character in a token could be made to delete the entire token.
There were some platform-specific changes that I had to make to deal with
drag-and-drop issues. I have made these only for the Windows platform,
because I know nothing at all about the other supported platforms. One of
the changes is that SCN_MOD_INSERTCHECK is now called repeatedly during a
drag operation so that the editor can show the correct user feedback if the
dragged text could not be dropped at the current position. I would not
expect that this would cause any backwards compatibility problems, unless
the container is doing a very expensive operation in response.
Would you like me to submit a patch (with further explanation of the
changes)? What is the best way to do this?
counterparts to SC_MOD_INSERTCHECK and SCI_CHANGEINSERTION in my own copy
of Scintilla. I would like to submit a patch if there is interest.
My motivation was to allow vetoing of changes to certain parts of the
document; SC_MOD_INSERTCHECK makes this possible for text insertion but I
also needed a similar method for text deletion. I originally tried to use
the SCI_STYLESETCHANGEABLE style attribute, but this has a number of
limitations that made it unsuitable for my use case â the most significant
being that it is not permitted to place the caret or make a selection in an
unchangeable region.
To veto an insertion it is just a matter of calling SCI_CHANGEINSERTION
with a length of zero and an empty string. I did have to modify the
implementation slightly so that such null-insertions don't cause an empty
undo action to be stored and the document potentially to leave its
save-point.
SCI_CHANGEDELETION allows the caller to modify the position and length of
the region being deleted. Setting the length to zero vetoes the deletion.
One of the original use-cases described by Neil for
SC_MOD_INSERTCHECK/SCI_CHANGEINSERTION was to replace certain Unicode
characters with equivalent character sequences, e.g. the n-dash character
with – in HTML. My changes extend this use case such that deleting a
single character in a token could be made to delete the entire token.
There were some platform-specific changes that I had to make to deal with
drag-and-drop issues. I have made these only for the Windows platform,
because I know nothing at all about the other supported platforms. One of
the changes is that SCN_MOD_INSERTCHECK is now called repeatedly during a
drag operation so that the editor can show the correct user feedback if the
dragged text could not be dropped at the current position. I would not
expect that this would cause any backwards compatibility problems, unless
the container is doing a very expensive operation in response.
Would you like me to submit a patch (with further explanation of the
changes)? What is the best way to do this?
--
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.
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.