コード例 #1
0
        private void DoAftermath(EditorControl editor, ActionResults exp, int selCount, Pos caret, int edit = 0)
        {
            var scrolled = false;

            if (exp.Has(Modify))
            {
                editor.Scroll.InvalidateLines(
                    exp.Has(AtomicChange) ? InvalidateFlags.Atomic : InvalidateFlags.None);

                if (editor.Scroll.ScrollPosition.Y + editor.Info.TextHeight < -editor.Scroll.ScrollBounds.Height)
                {
                    exp |= Scroll;
                }

                if (!exp.Has(ShallowChange))
                {
                    editor.Buffer.Edits += edit;
                }

                if (!exp.Has(KeepRedo))
                {
                    editor.Buffer.RedoStack.Clear();
                }

                if (editor.HasContentModified)
                {
                    editor.OnContentModified();
                }
            }

            if (exp.Has(SetEditRange))
            {
                editor.FirstEditLine = int.MaxValue;
                editor.LastEditLine  = 0;
                SetEditLines(editor);
            }

            if (exp.Has(RestoreCaret))
            {
                SetCarets(editor, selCount, caret);
            }

            if (exp.Has(SetEditRange))
            {
                SetEditLines(editor);
            }

            if (exp.Has(Scroll))
            {
                editor.Scroll.SuppressOnScroll = true;
                scrolled = editor.Scroll.UpdateVisibleRectangle();
                editor.Scroll.SuppressOnScroll = false;
            }

            if (exp.Has(UpdateScrollInfo))
            {
                editor.Buffer.UpdateScrollInfo(editor);
            }

            if (/*scrolled ||*/ exp.Has(Modify))
            {
                editor.Styles.Restyle();
                editor.Search.RequestSearch();
            }

            if (!exp.Has(Silent))
            {
                editor.Buffer.RequestRedraw();
            }

            if (exp.Has(Modify))
            {
                editor.Folding.RebuildFolding();
            }

            if (exp.Has(LeaveEditor))
            {
                editor.Buffer.Selections.Truncate();
            }
        }