Esempio n. 1
0
        void OpenFile(FilePosition pos)
        {
            if (pos.Equals(oldPosition))
            {
                return;
            }
            oldPosition = pos;
            if (pos.FileName != currentFileName)
            {
                LoadFile(pos.FileName);
            }
            ctl.TextArea.Caret.Location = new ICSharpCode.AvalonEdit.Document.TextLocation(pos.Line, pos.Column);
            Rect r = ctl.TextArea.Caret.CalculateCaretRectangle();

            if (!r.IsEmpty)
            {
                ctl.ScrollToVerticalOffset(r.Top - 4);
            }
        }
        void OpenFile(DomRegion pos)
        {
            if (pos.Equals(oldPosition))
            {
                return;
            }
            oldPosition = pos;
            var fileName = new FileName(pos.FileName);

            if (fileName != currentFileName)
            {
                LoadFile(fileName);
            }
            ctl.TextArea.Caret.Location = pos.Begin;
            Rect r = ctl.TextArea.Caret.CalculateCaretRectangle();

            if (!r.IsEmpty)
            {
                ctl.ScrollToVerticalOffset(r.Top - 4);
            }
        }