| 4732 | } |
| 4733 | |
| 4734 | void Editor::NotifyModified ( Document *, DocModification mh, void * ) |
| 4735 | { |
| 4736 | ContainerNeedsUpdate ( SC_UPDATE_CONTENT ); |
| 4737 | if ( paintState == painting ) { |
| 4738 | CheckForChangeOutsidePaint ( Range ( mh.position, mh.position + mh.length ) ); |
| 4739 | } |
| 4740 | if ( mh.modificationType & SC_MOD_CHANGELINESTATE ) { |
| 4741 | if ( paintState == painting ) { |
| 4742 | CheckForChangeOutsidePaint ( |
| 4743 | Range ( pdoc->LineStart ( mh.line ), pdoc->LineStart ( mh.line + 1 ) ) ); |
| 4744 | } else { |
| 4745 | // Could check that change is before last visible line. |
| 4746 | Redraw(); |
| 4747 | } |
| 4748 | } |
| 4749 | if ( mh.modificationType & SC_MOD_LEXERSTATE ) { |
| 4750 | if ( paintState == painting ) { |
| 4751 | CheckForChangeOutsidePaint ( |
| 4752 | Range ( mh.position, mh.position + mh.length ) ); |
| 4753 | } else { |
| 4754 | Redraw(); |
| 4755 | } |
| 4756 | } |
| 4757 | if ( mh.modificationType & ( SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR ) ) { |
| 4758 | if ( mh.modificationType & SC_MOD_CHANGESTYLE ) { |
| 4759 | pdoc->IncrementStyleClock(); |
| 4760 | } |
| 4761 | if ( paintState == notPainting ) { |
| 4762 | if ( mh.position < pdoc->LineStart ( topLine ) ) { |
| 4763 | // Styling performed before this view |
| 4764 | Redraw(); |
| 4765 | } else { |
| 4766 | InvalidateRange ( mh.position, mh.position + mh.length ); |
| 4767 | } |
| 4768 | } |
| 4769 | if ( mh.modificationType & SC_MOD_CHANGESTYLE ) { |
| 4770 | llc.Invalidate ( LineLayout::llCheckTextAndStyle ); |
| 4771 | } |
| 4772 | } else { |
| 4773 | // Move selection and brace highlights |
| 4774 | if ( mh.modificationType & SC_MOD_INSERTTEXT ) { |
| 4775 | sel.MovePositions ( true, mh.position, mh.length ); |
| 4776 | braces[0] = MovePositionForInsertion ( braces[0], mh.position, mh.length ); |
| 4777 | braces[1] = MovePositionForInsertion ( braces[1], mh.position, mh.length ); |
| 4778 | } else if ( mh.modificationType & SC_MOD_DELETETEXT ) { |
| 4779 | sel.MovePositions ( false, mh.position, mh.length ); |
| 4780 | braces[0] = MovePositionForDeletion ( braces[0], mh.position, mh.length ); |
| 4781 | braces[1] = MovePositionForDeletion ( braces[1], mh.position, mh.length ); |
| 4782 | } |
| 4783 | if ( ( mh.modificationType & ( SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE ) ) && cs.HiddenLines() ) { |
| 4784 | // Some lines are hidden so may need shown. |
| 4785 | // TODO: check if the modified area is hidden. |
| 4786 | if ( mh.modificationType & SC_MOD_BEFOREINSERT ) { |
| 4787 | int lineOfPos = pdoc->LineFromPosition ( mh.position ); |
| 4788 | bool insertingNewLine = false; |
| 4789 | for ( int i = 0; i < mh.length; i++ ) { |
| 4790 | if ( ( mh.text[i] == '\n' ) || ( mh.text[i] == '\r' ) ) { |
| 4791 | insertingNewLine = true; |
nothing calls this directly
no test coverage detected