This project is read-only.

BeforeTextDelete EventArgs bugged?

Sep 21, 2013 at 11:45 PM

I have a problem using the Scintilla Event BeforeTextDelete. It seems that the EventArgs Field Text does not contain any value, independent of the changes made in the text. So for this example code never displays anything:
void scintilla1_BeforeTextDelete(object sender, TextModifiedEventArgs e)
            // Does not work
            textBox1.Text = e.Text;
while the BeforeTextInsert does work:
void scintilla1_BeforeTextInsert(object sender, TextModifiedEventArgs e)
            // Works
            textBox1.Text = e.Text;
This is quite annoying because I actually need the deleted text for my dynamic highlighting... How can I solve this problem?

Sep 24, 2013 at 4:49 AM
You can use the event's Position and Length property to get the range of text being deleted (it's still there). i.e.
Range range = scintilla.GetRange(e.Position, e.Position + e.Length);