//‚±‚ê‚ð‘—‚Á‚Ä‚‚éƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Í vi‚ʼnº•ûƒXƒNƒ[ƒ‹ protected void ProcessDeleteLines(string param) { int d = ParseInt(param, 1); /* * TerminalDocument doc = GetDocument(); * _manipulator.Clear(GetConnection().TerminalWidth); * GLine target = doc.CurrentLine; * for(int i=0; i<d; i++) { * target.Clear(); * target = target.NextLine; * } */ TerminalDocument doc = GetDocument(); int caret_col = doc.CaretColumn; int offset = doc.CurrentLineNumber - doc.TopLineNumber; //GLine nl = _manipulator.Export(); //doc.ReplaceCurrentLine(nl); if (doc.ScrollingBottom == -1) { doc.SetScrollingRegion(0, doc.TerminalHeight - 1); } for (int i = 0; i < d; i++) { doc.ScrollDown(/* doc.CurrentLineNumber, doc.ScrollingBottom */); doc.CurrentLineNumber = doc.TopLineNumber + offset; } //_manipulator.Load(doc.CurrentLine, caret_col); }
public AbstractTerminal(TerminalInitializeInfo info) { //TerminalEmulatorPlugin.Instance.LaterInitialize(); _session = info.Session; // //_invalidateParam = new InvalidateParam(); _document = new TerminalDocument(info.InitialWidth, info.InitialHeight); //_document.SetOwner(_session.ISession); _afterExitLockActions = new List <AfterExitLockDelegate>(); _decoder = new ISO2022CharDecoder(this, EncodingProfile.Get(info.Session.TerminalSettings.Encoding)); _terminalMode = TerminalMode.Normal; _logService = new LogService(info.TerminalParameter, _session.TerminalSettings, _session.TerminalOptions); //_promptRecognizer = new PromptRecognizer(this); //if (info.Session.TerminalSettings.LogSettings != null) //{ // _logService.ApplyLogSettings(_session.TerminalSettings.LogSettings, false); //} //event handlers ITerminalSettings ts = info.Session.TerminalSettings; ts.ChangeEncoding += delegate(EncodingType t) { this.Reset(); }; _document.DebugFlag = ts.DebugFlag; _document.LineFeedRule = GetTerminalSettings().LineFeedRule; //(Telnet.LineFeedRule) //ToDo: Set Encoding //_document.Encoding = Encoding.GetEncoding("iso-2022-jp") }
//CSI K private void ProcessEraseInLine(string param) { int d = ParseInt(param, 0); TerminalDocument doc = GetDocument(); switch (d) { case 0: //erase right doc.RemoveAfterCaret(); break; case 1: //erase left doc.CleanLineRange(0, doc.CaretColumn); break; case 2: //erase all //doc.Clear(GetDocument().TerminalWidth); doc.CleanLineRange(0, doc.TerminalWidth); break; default: throw new UnknownEscapeSequenceException(String.Format("unknown EL option {0}", param)); } }
//CSI J protected void ProcessEraseInDisplay(string param) { int d = ParseInt(param, 0); TerminalDocument doc = GetDocument(); int col = doc.CaretColumn; switch (d) { case 0: //erase below doc.RemoveAfterCaret(); //doc.RemoveAfter(doc.TopLineNumber+doc.TerminalHeight); doc.ClearAfter(doc.CurrentLineNumber + 1); //_manipulator.Load(doc.CurrentLine, col); break; case 1: //erase above //_manipulator.FillSpace(0, _manipulator.CaretColumn); //doc.ReplaceCurrentLine(_manipulator.Export()); doc.ClearRange(doc.TopLineNumber, doc.CurrentLineNumber); //_manipulator.Load(doc.CurrentLine, col); break; case 2: //erase all doc.ClearAfter(doc.TopLineNumber); break; default: throw new UnknownEscapeSequenceException(String.Format("unknown ED option {0}", param)); } }
private void CleanupCommon() { if (!_cleanup) { _cleanup = true; _logService.Close(_document.CurrentLine); _document = null; _decoder = null; } }
private void RestoreScreen(int sw) { if (_savedScreen[sw] == null) { ClearScreen(); // emulate new buffer return; } TerminalDocument doc = GetDocument(); int w = doc.TerminalWidth; int m = doc.TerminalHeight; int t = doc.TopLineNumber; throw new InvalidOperationException("XTerm: RestoreScreen is not implemented!"); /* foreach(string l in _savedScreen[sw]) { * //l.ExpandBuffer(w); * doc.Replace(t, l); // doc.AddLine(l); * t++; * if(--m == 0) break; * } */ }
private void ProcessScrollDown(string param) { int d = ParseInt(param, 1); TerminalDocument doc = GetDocument(); int caret_col = doc.CaretColumn; int offset = doc.CurrentLineNumber - doc.TopLineNumber; //GLine nl = _manipulator.Export(); doc.CleanLineRange(0, doc.TerminalWidth); // .ReplaceCurrentLine(nl); if (doc.ScrollingBottom == -1) { doc.SetScrollingRegion(0, GetDocument().TerminalHeight - 1); } for (int i = 0; i < d; i++) { doc.ScrollUp(doc.ScrollingTop, doc.ScrollingBottom); // TerminalDocument's "Scroll-Up" means XTerm's "Scroll-Down" doc.CurrentLineNumber = doc.TopLineNumber + offset; // find correct GLine } //_manipulator.Load(doc.CurrentLine, caret_col); }
//‚±‚ê‚ð‘—‚Á‚Ä‚‚éƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Í vi‚Åã•ûƒXƒNƒ[ƒ‹ protected void ProcessInsertLines(string param) { int d = ParseInt(param, 1); TerminalDocument doc = GetDocument(); int caret_pos = doc.CaretColumn; int offset = doc.CurrentLineNumber - doc.TopLineNumber; //GLine nl = _manipulator.Export(); //doc.ReplaceCurrentLine(nl); if (doc.ScrollingBottom == -1) { doc.SetScrollingRegion(0, GetDocument().TerminalHeight - 1); } for (int i = 0; i < d; i++) { doc.ScrollUp(/* doc.CurrentLineNumber, doc.ScrollingBottom */); doc.CurrentLineNumber = doc.TopLineNumber + offset; } //_manipulator.Load(doc.CurrentLine, caret_pos); }
/* * //ModalTerminalTaskŽü•Ó * public virtual void StartModalTerminalTask(IModalTerminalTask task) { * _modalTerminalTask = task; * new ModalTerminalTaskSite(this).Start(task); * } * public virtual void EndModalTerminalTask() { * _modalTerminalTask = null; * } * public IModalTerminalTask CurrentModalTerminalTask { * get { * return _modalTerminalTask; * } * } */ #region IByteAsyncInputStream public void OnReception(ByteDataFragment data) { try { bool pass_to_terminal = true; //if(_modalTerminalTask!=null) { // bool show_input = _modalTerminalTask.ShowInputInTerminal; // _modalTerminalTask.OnReception(data); // if(!show_input) pass_to_terminal = false; //“ü—Í‚ðŒ©‚¹‚È‚¢(XMODEM‚Æ‚©)‚Ì‚Æ‚«‚̓^[ƒ~ƒiƒ‹‚É—^‚¦‚È‚¢ //} //ƒoƒCƒiƒŠƒƒO‚Ìo—Í _logService.BinaryLogger.Write(data); if (pass_to_terminal) { TerminalDocument document = _document; if (document != null) { lock (document) { //_invalidateParam.Reset(); //‚±‚±‚©‚ç‹ŒInput() //_manipulator.Load(GetDocument().CurrentLine, 0); //_manipulator.CaretColumn = GetDocument().CaretColumn; //ˆ—–{‘Ì _decoder.OnReception(data); //GetDocument().ReplaceCurrentLine(_manipulator.Export()); //GetDocument().CaretColumn = _manipulator.CaretColumn; //‚±‚±‚Ü‚Å //‰E’[‚ɃLƒƒƒŒƒbƒg‚ª—ˆ‚½‚Æ‚«‚Í•Ö‹X“I‚ÉŽŸs‚Ì“ª‚É‚à‚Á‚Ä‚¢‚ //if(document.CaretColumn==document.TerminalWidth) { // document.CurrentLineNumber++; //‚±‚ê‚É‚æ‚Á‚ÄŽŸs‚Ì‘¶Ý‚ð•ÛØ // document.CaretColumn = 0; //} CheckDiscardDocument(); //AdjustTransientScrollBar(); //Œ»Ýs‚ª‰º’[‚ÉŒ©‚¦‚é‚悤‚ÈScrollBarValue‚ðŒvŽZ //int n = document.CurrentLineNumber-document.TerminalHeight+1-document.FirstLineNumber; //if(n < 0) n = 0; //Debug.WriteLine(String.Format("E={0} C={1} T={2} H={3} LC={4} MAX={5} n={6}", _transientScrollBarEnabled, _tag.Document.CurrentLineNumber, _tag.Document.TopLineNumber, _tag.Connection.TerminalHeight, _transientScrollBarLargeChange, _transientScrollBarMaximum, n)); /* if(IsAutoScrollMode(n)) { * _scrollBarValues.Value = n; * document.TopLineNumber = n + document.FirstLineNumber; * } * else * _scrollBarValues.Value = document.TopLineNumber - document.FirstLineNumber; */ //Invalidate‚ðlock‚ÌŠO‚Éo‚·B‚±‚Ì‚Ù‚¤‚ªˆÀ‘S‚ÆŽv‚í‚ꂽ //ŽóMƒXƒŒƒbƒh“à‚ł̓}[ƒN‚ð‚‚¯‚é‚Ì‚ÝBƒ^ƒCƒ}[‚Ås‚¤‚Ì‚ÍIntelliSense‚É•›ì—p‚ ‚é‚̂ňꎞ’âŽ~ //_promptRecognizer.SetContentUpdateMark(); //_promptRecognizer.Recognize(); } } if (_afterExitLockActions.Count > 0) { //Control main = _session.OwnerWindow.AsControl(); //foreach(AfterExitLockDelegate action in _afterExitLockActions) { // main.Invoke(action); //} _afterExitLockActions.Clear(); } } //if(_modalTerminalTask!=null) _modalTerminalTask.NotifyEndOfPacket(); _session.NotifyViewsDataArrived(); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } }