#1577 Deleting line: deletes per-line data from wrong line

scintilla (297)
Gintaras Q

When deleting whole line, deletes per-line data (annotations, line state etc) from next line, not from the deleted line.

It is because void LineVector::RemoveLine(line) is called with 1-based line index, and it calls perLine->RemoveLine(line), which must be called with 0-based line index.

To fix: in LineVector::RemoveLine insert line--.

Related: when the range being deleted begins at the end of a line (eg when deleting last empty line (just \r\n)), deletes per-line data of that line. Should delete data of next line. But this is not so important.


  • Neil Hodgson

    Neil Hodgson - 2014-02-13
    • labels: --> scintilla
    • assigned_to: Neil Hodgson
  • Neil Hodgson

    Neil Hodgson - 2014-02-13

    The only case that appears wrong is for annotations. Markers were the original case and they are merged as needed. Folding levels after the deletion are invalid and so regenerated although the header flag is merged up. For line state, the lexer will regenerate the value.

    IIRC when writing the annotations code, I was thinking of merging the lines' annotations similarly to markers but wasn't sure so never implemented it.

  • Gintaras Q

    Gintaras Q - 2014-02-13

    Then one line in scintilla reference is incorrect. It says "When a line is deleted, its markers are combined, by an OR operation, with the markers of the previous line."
    Actually now are combined with markers of next line.
    After adding the -1 everything works well for me. Markers, annotations, states. Not tested others.

    Last edit: Gintaras Q 2014-02-13
    • Neil Hodgson

      Neil Hodgson - 2014-02-13

      Fixed documentation with [b1916a]. This behaviour is how it has always worked and makes sense to me.

      For folding, with fold debug (SciTE:fold.flags=64 line.margin.width=12), you can see a header flag migrate to the previous line with your change when deleting a fold start line (like '{' in C). While most of the folding code needs a change in level as well as the header flag, its possible this spurious header flag could cause problems in either Scintilla or client code.



      Commit: [b1916a]

  • Neil Hodgson

    Neil Hodgson - 2014-02-20

    Committed change for annotations as [35f557].



    Commit: [35f557]

  • Neil Hodgson

    Neil Hodgson - 2014-02-20
    • status: open --> open-fixed
  • Neil Hodgson

    Neil Hodgson - 2014-03-21
    • status: open-fixed --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks