示例#1
0
    private void InitVariantsText(string text)
    {
        variantsTextBox.Controller.InitText(text);
        variantsTextBox.Controller.ClearMinorSelections();
        Selection selection = variantsTextBox.Controller.LastSelection;
        int       index     = variantsTextBox.Controller.Lines.LinesCount - 1;

        if (string.IsNullOrEmpty(pattern))
        {
            int startIndex = StartVariantIndex;
            if (startIndex != -1)
            {
                index = startIndex;
            }
        }
        Place place = new Place(0, index);

        selection.anchor = selection.caret = variantsTextBox.Controller.Lines.IndexOf(place);
        variantsTextBox.Invalidate();
        Nest.size = tabBar.Height + variantsTextBox.CharHeight * (
            !string.IsNullOrEmpty(text) && variantsTextBox.Controller != null ?
            variantsTextBox.GetScrollSizeY() + 2 : 1
            ) + 4;
        variantsTextBox.Controller.NeedScrollToCaret();
        SetNeedResize();
    }
示例#2
0
    override public void Focus()
    {
        textBox.Focus();

        startViMode = MulticaretTextBox.initMacrosExecutor != null &&
                      MulticaretTextBox.initMacrosExecutor.viMode != ViMode.Insert;
        textBox.Text = text;
        textBox.Controller.ClearMinorSelections();
        for (int i = 0; i < textBox.Controller.Lines.LinesCount; i++)
        {
            Line line = textBox.Controller.Lines[i];
            if (i == 0)
            {
                textBox.Controller.PutCursor(new Place(0, i), false);
            }
            else
            {
                textBox.Controller.PutNewCursor(new Place(0, i));
            }
            int right = line.NormalCount;
            if (isDirectory != null && i < isDirectory.Count && !isDirectory[i])
            {
                for (int j = right; j-- > 1;)
                {
                    if (line.chars[j].c == '.')
                    {
                        right = j;
                        break;
                    }
                }
            }
            if (!startViMode)
            {
                textBox.Controller.PutCursor(new Place(right, i), true);
            }
        }
        textBox.Invalidate();
        Nest.size = tabBar.Height + textBox.CharHeight * (
            !string.IsNullOrEmpty(text) && textBox.Controller != null ? textBox.GetScrollSizeY() : 1
            ) + 4;
        SetNeedResize();
    }