예제 #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));
            }
        }
예제 #2
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
            {
                EraseRight();
                doc.ReplaceCurrentLine(_manipulator.Export());
                int bottom = doc.TopLineNumber + doc.TerminalHeight;
                doc.EnsureLine(bottom - 1);
                doc.RemoveAfter(bottom);
                doc.ClearRange(doc.CurrentLineNumber + 1, bottom, _currentdecoration);
                _manipulator.Load(doc.CurrentLine, col);
            }
            break;

            case 1:                     //erase above
            {
                EraseLeft();
                doc.ReplaceCurrentLine(_manipulator.Export());
                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;
                //}
                int top    = doc.TopLineNumber;
                int bottom = top + doc.TerminalHeight;
                doc.EnsureLine(bottom - 1);
                doc.RemoveAfter(bottom);
                doc.ClearRange(top, bottom, _currentdecoration);
                _manipulator.Load(doc.CurrentLine, col);
            }
            break;

            default:
                throw new UnknownEscapeSequenceException(String.Format("unknown ED option {0}", param));
            }
        }
예제 #3
0
        //CSI J
        protected void ProcessEraseInDisplay(string param)
        {
            int d = ParseInt(param, 0);

            TerminalDocument doc = GetDocument();
            int cur    = doc.CurrentLineNumber;
            int top    = doc.TopLineNumber;
            int bottom = top + doc.TerminalHeight;
            int col    = _manipulator.CaretColumn;

            switch (d)
            {
            case 0:     //erase below
            {
                if (col == 0 && cur == top)
                {
                    goto ERASE_ALL;
                }

                EraseRight();
                doc.ReplaceCurrentLine(_manipulator.Export());
                doc.EnsureLine(bottom - 1);
                doc.RemoveAfter(bottom);
                doc.ClearRange(cur + 1, bottom, _currentdecoration);
                _manipulator.Load(doc.CurrentLine, col);
            }
            break;

            case 1:     //erase above
            {
                if (col == doc.TerminalWidth - 1 && cur == bottom - 1)
                {
                    goto ERASE_ALL;
                }

                EraseLeft();
                doc.ReplaceCurrentLine(_manipulator.Export());
                doc.ClearRange(top, cur, _currentdecoration);
                _manipulator.Load(doc.CurrentLine, col);
            }
            break;

            case 2:     //erase all
ERASE_ALL:
                {
                    GetDocument().ApplicationModeBackColor = (_currentdecoration != null) ? _currentdecoration.BackColor : Color.Empty;

                    doc.ReplaceCurrentLine(_manipulator.Export());
                    //if(_homePositionOnCSIJ2) { //SFUではこうなる
                    //	ProcessCursorPosition(1,1);
                    //	col = 0;
                    //}
                    doc.EnsureLine(bottom - 1);
                    doc.RemoveAfter(bottom);
                    doc.ClearRange(top, bottom, _currentdecoration);
                    _manipulator.Load(doc.CurrentLine, col);
                }
                break;

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