예제 #1
0
        internal static void BreakLines(int iLine, int pos, FastColoredTextBox tb)
        {
            Line newLine = new Line(tb.GenerateUniqueLineId());

            for (int i = pos; i < tb[iLine].Count; i++)
            {
                newLine.Add(tb[iLine][i]);
            }
            tb[iLine].RemoveRange(pos, tb[iLine].Count - pos);
            tb.InsertLine(iLine + 1, newLine);
        }
예제 #2
0
        internal static void InsertLine(FastColoredTextBox tb)
        {
            if (tb.LinesCount == 0)
            {
                tb.InsertLine(tb.Selection.Start.iLine + 1, new Line(tb.GenerateUniqueLineId()));
            }
            else
            {
                BreakLines(tb.Selection.Start.iLine, tb.Selection.Start.iChar, tb);
            }

            tb.Selection.Start = new Place(0, tb.Selection.Start.iLine + 1);
            tb.needRecalc      = true;
        }