//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)); } }
//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)); } }