public CommandResult ClearScreen() { ConnectionTag tag = GEnv.Connections.FindTag(_connection); TerminalDocument doc = tag.Document; lock (doc) { GLine l = doc.TopLine; int top_id = l.ID; int limit = l.ID + _connection.TerminalHeight; while (l != null && l.ID < limit) { l.Clear(); l = l.NextLine; } doc.CurrentLineNumber = top_id; doc.CaretColumn = 0; doc.InvalidateAll(); if (tag.Pane != null) { GEnv.TextSelection.Clear(); tag.Pane.Invalidate(); } } return(CommandResult.Success); }