Exemple #1
0
        //CSI J
        protected void ProcessEraseInDisplay(string param)
        {
            int d = ParseInt(param, 0);

            TerminalDocument doc = GetDocument();
            int col = _manipulator.CaretColumn;

            switch (d)
            {
            case 0:                     //erase below
                _manipulator.RemoveAfterCaret();
                doc.ReplaceCurrentLine(_manipulator.Export());
                doc.RemoveAfter(doc.TopLineNumber + GetConnection().TerminalHeight);
                if (_currentdecoration.IsDefault)
                {
                    doc.ClearAfter(doc.CurrentLineNumber + 1);
                }
                else
                {
                    doc.ClearAfter(doc.CurrentLineNumber + 1, _currentdecoration);
                }
                _manipulator.Load(doc.CurrentLine, col);
                break;

            case 1:                     //erase above
                _manipulator.FillSpace(0, _manipulator.CaretColumn);
                doc.ReplaceCurrentLine(_manipulator.Export());
                if (_currentdecoration.IsDefault)
                {
                    doc.ClearRange(doc.TopLineNumber, doc.CurrentLineNumber);
                }
                else
                {
                    doc.ClearRange(doc.TopLineNumber, doc.CurrentLineNumber, _currentdecoration);
                }
                _manipulator.Load(doc.CurrentLine, col);
                break;

            case 2:                       //erase all
                doc.ReplaceCurrentLine(_manipulator.Export());
                if (_homePositionOnCSIJ2) //SFUではこうなる
                {
                    ProcessCursorPosition(1, 1);
                    col = 0;
                }
                if (_currentdecoration.IsDefault)
                {
                    doc.ClearAfter(doc.TopLineNumber);
                }
                else
                {
                    doc.ClearAfter(doc.TopLineNumber, _currentdecoration);
                }
                _manipulator.Load(doc.CurrentLine, col);
                break;

            default:
                throw new UnknownEscapeSequenceException(String.Format("unknown ED option {0}", param));
            }
        }