0

I need a code snippet to delete the last line of ScintillaNET control and append a line to it. I tried this but didn't work:

        scintilla1.GoTo.Line(scintilla1.Lines.Count);
        int nowPosition = scintilla1.Caret.Position;
        scintilla1.Text.Remove(nowPosition);
CodeEmpower
  • 635
  • 1
  • 11
  • 29

1 Answers1

0

Sorry about being late. I found this post and was sad to see nothing good (not your fault) so I kept looking around and found this:

((INativeScintilla)scintilla).DeleteBack()

This will simulate a backspace key press (remove 1 character on the left of the cursor). It isnt pretty but it could get the job done for you. Worked for me :)

For you, you could store the cursor position in an int, set it to the end, 'backspace' all the characters you want, then set it back.

Tharif
  • 13,794
  • 9
  • 55
  • 77
Sellorio
  • 1,806
  • 1
  • 16
  • 32
  • I have come across memory corruption when using this method. Haven't found any alternatives though >. – Sellorio May 19 '13 at 23:01