Пример #1
0
        void AssertSelectionsAreEqual(SimpleSelection expectedSelection, IScriptingConsoleTextEditor consoleTextEditor)
        {
            int             selectionLength = consoleTextEditor.SelectionStart + consoleTextEditor.SelectionLength;
            SimpleSelection actualSelection = new SimpleSelection(consoleTextEditor.SelectionStart, selectionLength);

            Assert.AreEqual(expectedSelection, actualSelection);
        }
Пример #2
0
    private void Exit(Vector2Int gridPoint)
    {
        Disactivate();

        SimpleSelection step = GetComponent <SimpleSelection>();

        step.Activate(gridPoint);
    }
Пример #3
0
    public void Castle(int index)
    {
        SimpleSelection SS = GetComponent <SimpleSelection>();

        SS.Disactivate();
        Disactivate();

        GameManager.instance.Castle(index);
    }
Пример #4
0
        public void SelectionLength_NothingSelectedInTextEditor_ConsoleTextEditorSelectionMatchesTextEditorSelection()
        {
            avalonEditTextEditor.Text = "text";
            avalonEditTextEditor.TextArea.Caret.Column = 1;
            avalonEditTextEditor.SelectionLength       = 0;

            SimpleSelection expectedSelection = new SimpleSelection(1, 1);

            AssertSelectionsAreEqual(expectedSelection, consoleTextEditor);
        }
Пример #5
0
    private void Cancel()
    {
        Disactivate();

        Display.instance.selector = null;

        SimpleSelection goTo = GetComponent <SimpleSelection>();

        goTo.Activate(startGridPoint);
    }
Пример #6
0
        public UpdateBuilder <T> Set(Expression <Func <T, object> > select, object value)
        {
            SimpleSelection selection = BuilderHelper.ParseSimpleSelection(select);

            if (selection != null)
            {
                CurrentQuery.Assignments.Add(new Assignment(selection, GenerateBindMarker(value)));
            }

            return(this);
        }
Пример #7
0
        /// <summary>
        /// Selects the specified text section.
        /// </summary>
        public void Select(int start, int length)
        {
            int documentLength = Document != null ? Document.TextLength : 0;

            if (start < 0 || start > documentLength)
            {
                throw new ArgumentOutOfRangeException("start", start, "Value must be between 0 and " + documentLength);
            }
            if (length < 0 || start + length > documentLength)
            {
                throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + (documentLength - start));
            }
            textArea.Selection    = SimpleSelection.Create(textArea, start, start + length);
            textArea.Caret.Offset = start + length;
        }
Пример #8
0
        public void SelectionStart_ThreeCharactersSelectedInTextEditor_ConsoleTextEditorSelectionIsEqualToTextEditorSelection()
        {
            avalonEditTextEditor.Text = "te000xt";
            int             startOffset       = 2;
            int             endOffset         = 5;
            SimpleSelection expectedSelection = new SimpleSelection(startOffset, endOffset);

            avalonEditTextEditor.SelectionStart  = expectedSelection.StartOffset;
            avalonEditTextEditor.SelectionLength = expectedSelection.Length;

            // Sanity check.
            Assert.AreEqual("000", avalonEditTextEditor.SelectedText);

            AssertSelectionsAreEqual(expectedSelection, consoleTextEditor);
        }
Пример #9
0
        public DeleteBuilder <T> Delete(params Expression <Func <T, object> >[] selects)
        {
            if (selects != null)
            {
                foreach (Expression <Func <T, object> > select in selects)
                {
                    SimpleSelection selection = BuilderHelper.ParseSimpleSelection(select);

                    if (selection != null)
                    {
                        CurrentQuery.Selections.Add(selection);
                    }
                }
            }

            return(this);
        }
        public void TextInsertedAtCursor()
        {
            textEditor.Text        = "abc.n";
            textEditor.CaretOffset = 4;

            int             startOffset = 4;
            int             endOffset   = 5;
            SimpleSelection selection   = new SimpleSelection(startOffset, endOffset);

            completionData = new ScriptingConsoleCompletionData("new");
            completionData.Complete(textEditor.TextArea, selection, null);

            string expectedText =
                "abc.new";

            Assert.AreEqual(expectedText, textEditor.Text);
        }
Пример #11
0
 public void JumpTo(int line, int column)
 {
     locationJumpedTo = new Location(column, line);
     selection        = new SimpleSelection(-1, -1);
 }
Пример #12
0
 public void Select(int selectionStart, int selectionLength)
 {
     selection = new SimpleSelection(selectionStart, selectionLength + selectionStart);
 }