Exemplo n.º 1
0
        void advanceCursorRow()
        {
            cursorRow++;

            if (cursorRow == Size.Row)
            {
                var oldLine = lines[0];
                var newLine = new TerminalLine();
                cursorRow--;
                Array.Copy(lines, 1, lines, 0, lines.Length - 1);
                lines[lines.Length - 1] = newLine;

                LinesMoved?.Invoke(this, new LinesMovedEventArgs(1, 0, Size.Row - 1));
            }
        }
Exemplo n.º 2
0
        public void MoveLines(int index, int newIndex, int count)
        {
            int addIndex;

            if (newIndex > index)
            {
                addIndex = index;
            }
            else
            {
                addIndex = newIndex + count;
            }

            int addedCount = Math.Abs(index - newIndex);

            Array.Copy(lines, index, lines, newIndex, count);
            for (int i = 0; i < addedCount; ++i)
            {
                lines[addIndex + i] = new TerminalLine();
            }

            LinesMoved?.Invoke(this, new LinesMovedEventArgs(index, newIndex, count));
        }