protected override ProcessCharResult ProcessDECSET(string param, char code) { ProcessCharResult v = base.ProcessDECSET(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } bool set = code == 'h'; switch (param) { case "1047": //Alternate Buffer if (set) { SwitchBuffer(true); // XTerm doesn't clear screen. } else { ClearScreen(); SwitchBuffer(false); } return(ProcessCharResult.Processed); case "1048": //Save/Restore Cursor if (set) { SaveCursor(); } else { RestoreCursor(); } return(ProcessCharResult.Processed); case "1049": //Save/Restore Cursor and Alternate Buffer if (set) { SaveCursor(); SwitchBuffer(true); ClearScreen(); } else { // XTerm doesn't clear screen for enabling copy/paste from the alternate buffer. // But we need ClearScreen for emulating the buffer-switch. ClearScreen(); SwitchBuffer(false); RestoreCursor(); } return(ProcessCharResult.Processed); case "1000": case "1001": case "1002": case "1003": //マウス関係は無視 return(ProcessCharResult.Processed); case "1034": // Input 8 bits return(ProcessCharResult.Processed); case "3": //132 Column Mode return(ProcessCharResult.Processed); case "4": //Smooth Scroll なんのことやら return(ProcessCharResult.Processed); case "5": SetReverseVideo(set); return(ProcessCharResult.Processed); case "6": //Origin Mode _scrollRegionRelative = set; return(ProcessCharResult.Processed); case "7": _wrapAroundMode = set; return(ProcessCharResult.Processed); case "12": //一応報告あったので。SETMODEの12ならローカルエコーなんだがな return(ProcessCharResult.Processed); case "47": if (set) { SwitchBuffer(true); } else { SwitchBuffer(false); } return(ProcessCharResult.Processed); default: return(ProcessCharResult.Unsupported); } }
protected override ProcessCharResult ProcessAfterCSI(string param, char code) { ProcessCharResult v = base.ProcessAfterCSI(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } switch (code) { case 'd': ProcessLinePositionAbsolute(param); return(ProcessCharResult.Processed); case 'G': case '`': //CSI Gは実際に来たことがあるが、これは来たことがない。いいのか? ProcessLineColumnAbsolute(param); return(ProcessCharResult.Processed); case 'X': ProcessEraseChars(param); return(ProcessCharResult.Processed); case 'P': _manipulator.DeleteChars(_manipulator.CaretColumn, ParseInt(param, 1), _currentdecoration); return(ProcessCharResult.Processed); case 'p': return(SoftTerminalReset(param)); case '@': _manipulator.InsertBlanks(_manipulator.CaretColumn, ParseInt(param, 1), _currentdecoration); return(ProcessCharResult.Processed); case 'I': ProcessForwardTab(param); return(ProcessCharResult.Processed); case 'Z': ProcessBackwardTab(param); return(ProcessCharResult.Processed); case 'S': ProcessScrollUp(param); return(ProcessCharResult.Processed); case 'T': ProcessScrollDown(param); return(ProcessCharResult.Processed); case 'g': ProcessTabClear(param); return(ProcessCharResult.Processed); case 't': //!!パラメータによって無視してよい場合と、応答を返すべき場合がある。応答の返し方がよくわからないので保留中 return(ProcessCharResult.Processed); case 'U': //これはSFUでしか確認できてない base.ProcessCursorPosition(GetDocument().TerminalHeight, 1); return(ProcessCharResult.Processed); case 'u': //SFUでのみ確認。特にbは続く文字を繰り返すらしいが、意味のある動作になっているところを見ていない case 'b': return(ProcessCharResult.Processed); default: return(ProcessCharResult.Unsupported); } }
protected override ProcessCharResult ProcessAfterOSC(string param, char code) { ProcessCharResult v = base.ProcessAfterOSC(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } int semicolon = param.IndexOf(';'); if (semicolon == -1) { return(ProcessCharResult.Unsupported); } string ps = param.Substring(0, semicolon); string pt = param.Substring(semicolon + 1); if (ps == "0" || ps == "2") { IDynamicCaptionFormatter[] fmts = TerminalEmulatorPlugin.Instance.DynamicCaptionFormatter; TerminalDocument doc = GetDocument(); if (fmts.Length > 0) { ITerminalSettings settings = GetTerminalSettings(); string title = fmts[0].FormatCaptionUsingWindowTitle(GetConnection().Destination, settings, pt); _afterExitLockActions.Add(new AfterExitLockDelegate(new CaptionChanger(GetTerminalSettings(), title).Do)); } //Quick Test //_afterExitLockActions.Add(new AfterExitLockDelegate(new CaptionChanger(GetTerminalSettings(), pt).Do)); return(ProcessCharResult.Processed); } else if (ps == "1") { return(ProcessCharResult.Processed); //Set Icon Nameというやつだが無視でよさそう } else if (ps == "4") { // パレット変更 // 形式: OSC 4 ; 色番号 ; 色指定 ST // 色番号: 0〜255 // 色指定: 以下の形式のどれか // #rgb // #rrggbb // #rrrgggbbb // #rrrrggggbbbb // rgb:r/g/b // rgb:rr/gg/bb // rgb:rrr/ggg/bbb // rgb:rrrr/gggg/bbbb // 他にも幾つか形式があるけれど、通常はこれで十分と思われる。 // 他の形式は XParseColor(1) を参照 // // 参考: http://ttssh2.sourceforge.jp/manual/ja/about/ctrlseq.html#OSC // while ((semicolon = pt.IndexOf(';')) != -1) { string pv = pt.Substring(semicolon + 1); int pn; if (Int32.TryParse(pt.Substring(0, semicolon), out pn) && pn >= 0 && pn <= 255) { if ((semicolon = pv.IndexOf(';')) != -1) { pt = pv.Substring(semicolon + 1); pv = pv.Substring(0, semicolon); } else { pt = pv; } int r, g, b; if (pv.StartsWith("#")) { switch (pv.Length) { case 4: // #rgb if (Int32.TryParse(pv.Substring(1, 1), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out r) && Int32.TryParse(pv.Substring(2, 1), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out g) && Int32.TryParse(pv.Substring(3, 1), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out b)) { r <<= 4; g <<= 4; b <<= 4; } else { return(ProcessCharResult.Unsupported); } break; case 7: // #rrggbb if (Int32.TryParse(pv.Substring(1, 2), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out r) && Int32.TryParse(pv.Substring(3, 2), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out g) && Int32.TryParse(pv.Substring(5, 2), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out b)) { } else { return(ProcessCharResult.Unsupported); } break; case 10: // #rrrgggbbb if (Int32.TryParse(pv.Substring(1, 3), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out r) && Int32.TryParse(pv.Substring(4, 3), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out g) && Int32.TryParse(pv.Substring(7, 3), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out b)) { r >>= 4; g >>= 4; b >>= 4; } else { return(ProcessCharResult.Unsupported); } break; case 13: // #rrrrggggbbbb if (Int32.TryParse(pv.Substring(1, 4), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out r) && Int32.TryParse(pv.Substring(5, 4), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out g) && Int32.TryParse(pv.Substring(9, 4), NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out b)) { r >>= 8; g >>= 8; b >>= 8; } else { return(ProcessCharResult.Unsupported); } break; default: return(ProcessCharResult.Unsupported); } } else if (pv.StartsWith("rgb:")) // rgb:rr/gg/bb { string[] vals = pv.Substring(4).Split(new Char[] { '/' }); if (vals.Length == 3 && vals[0].Length == vals[1].Length && vals[0].Length == vals[2].Length && vals[0].Length > 0 && vals[0].Length <= 4 && Int32.TryParse(vals[0], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out r) && Int32.TryParse(vals[1], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out g) && Int32.TryParse(vals[2], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out b)) { switch (vals[0].Length) { case 1: r <<= 4; g <<= 4; b <<= 4; break; case 3: r >>= 4; g >>= 4; b >>= 4; break; case 4: r >>= 8; g >>= 8; b >>= 8; break; } } else { return(ProcessCharResult.Unsupported); } } else { return(ProcessCharResult.Unsupported); } GetRenderProfile().ESColorSet[pn] = Color.FromArgb(r, g, b); } else { return(ProcessCharResult.Unsupported); } } return(ProcessCharResult.Processed); } else { return(ProcessCharResult.Unsupported); } }
protected override void ResetInternal() { _escapeSequence = new StringBuilder(); _processCharResult = ProcessCharResult.Processed; }
public override void ProcessChar(char ch) { _logger = Logger; if (_processCharResult != ProcessCharResult.Escaping) { if (ch == 0x1B) { _processCharResult = ProcessCharResult.Escaping; } else { _logger.Append(ch); if (GEnv.Frame.MacroIsRunning) { AppendMacroBuffer(ch); } if (ch < 0x20 || (ch >= 0x80 && ch < 0xA0)) { _processCharResult = ProcessControlChar(ch); } else { _processCharResult = ProcessNormalChar(ch); } } } else { if (ch == '\0') { return; } _escapeSequence.Append(ch); bool end_flag = false; //escape sequence if (_escapeSequence.Length == 1) //ESC+ { end_flag = ('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || ch == '>' || ch == '=' || ch == '|' || ch == '}' || ch == '~'; } else if (_escapeSequence[0] == ']') //OSC (String Terminator) { end_flag = ch == 0x07 || ch == 0x9c; } else { end_flag = ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || ch == '@' || ch == '~' || ch == '|' || ch == '{'; } if (end_flag) { char[] seq = _escapeSequence.ToString().ToCharArray(); _logger.BeginEscapeSequence(); _logger.Append(seq, 0, seq.Length); _logger.CommitEscapeSequence(); _logger.Flush(); try { char code = seq[0]; _processCharResult = ProcessCharResult.Unsupported; //ProcessEscapeSequence _processCharResult = ProcessEscapeSequence(code, seq, 1); if (_processCharResult == ProcessCharResult.Unsupported) { throw new UnknownEscapeSequenceException(String.Format("ESC {0}", new string(seq))); } } catch (UnknownEscapeSequenceException ex) { if (GEnv.Options.WarningOption != Poderosa.Config.WarningOption.Ignore) { GEnv.InterThreadUIService.UnsupportedEscapeSequence(GetDocument(), GEnv.Strings.GetString("Message.EscapesequenceTerminal.UnsupportedSequence") + ex.Message); } } finally { _escapeSequence.Remove(0, _escapeSequence.Length); } } else { _processCharResult = ProcessCharResult.Escaping; } } }
protected override ProcessCharResult ProcessDECSET(string param, char code) { ProcessCharResult v = base.ProcessDECSET(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } bool set = code == 'h'; switch (param) { case "1047": //Alternate Buffer if (set) { SwitchBuffer(true); // XTerm doesn't clear screen. } else { ClearScreen(); SwitchBuffer(false); } return(ProcessCharResult.Processed); case "1048": //Save/Restore Cursor if (set) { SaveCursor(); } else { RestoreCursor(); } return(ProcessCharResult.Processed); case "1049": //Save/Restore Cursor and Alternate Buffer if (set) { SaveCursor(); SwitchBuffer(true); ClearScreen(); } else { // XTerm doesn't clear screen for enabling copy/paste from the alternate buffer. // But we need ClearScreen for emulating the buffer-switch. ClearScreen(); SwitchBuffer(false); RestoreCursor(); } return(ProcessCharResult.Processed); case "1000": // DEC VT200 compatible: Send button press and release event with mouse position. ResetMouseTracking((set) ? MouseTrackingState.Normal : MouseTrackingState.Off); return(ProcessCharResult.Processed); case "1001": // DEC VT200 highlight tracking // Not supported ResetMouseTracking(MouseTrackingState.Off); return(ProcessCharResult.Processed); case "1002": // Button-event tracking: Send button press, release, and drag event. ResetMouseTracking((set) ? MouseTrackingState.Drag : MouseTrackingState.Off); return(ProcessCharResult.Processed); case "1003": // Any-event tracking: Send button press, release, and motion. ResetMouseTracking((set) ? MouseTrackingState.Any : MouseTrackingState.Off); return(ProcessCharResult.Processed); case "1004": // Send FocusIn/FocusOut events _focusReportingMode = set; return(ProcessCharResult.Processed); case "1005": // Enable UTF8 Mouse Mode if (set) { _mouseTrackingProtocol = MouseTrackingProtocol.Utf8; } else { _mouseTrackingProtocol = MouseTrackingProtocol.Normal; } return(ProcessCharResult.Processed); case "1006": // Enable SGR Extended Mouse Mode if (set) { _mouseTrackingProtocol = MouseTrackingProtocol.Sgr; } else { _mouseTrackingProtocol = MouseTrackingProtocol.Normal; } return(ProcessCharResult.Processed); case "1015": // Enable UTF8 Extended Mouse Mode if (set) { _mouseTrackingProtocol = MouseTrackingProtocol.Urxvt; } else { _mouseTrackingProtocol = MouseTrackingProtocol.Normal; } return(ProcessCharResult.Processed); case "1034": // Input 8 bits return(ProcessCharResult.Processed); case "3": //132 Column Mode return(ProcessCharResult.Processed); case "4": //Smooth Scroll なんのことやら return(ProcessCharResult.Processed); case "5": SetReverseVideo(set); return(ProcessCharResult.Processed); case "6": //Origin Mode _scrollRegionRelative = set; return(ProcessCharResult.Processed); case "7": _wrapAroundMode = set; return(ProcessCharResult.Processed); case "12": //一応報告あったので。SETMODEの12ならローカルエコーなんだがな return(ProcessCharResult.Processed); case "47": if (set) { SwitchBuffer(true); } else { SwitchBuffer(false); } return(ProcessCharResult.Processed); default: return(ProcessCharResult.Unsupported); } }
public EscapeSequenceTerminal(ConnectionTag tag, ICharDecoder decoder) : base(tag, decoder) { _escapeSequence = new StringBuilder(); _processCharResult = ProcessCharResult.Processed; }
public override void ProcessChar(char ch) { _logger = Logger; //_logger�͂���ProcessChar�̏�����ł̂ݗL���B if(_processCharResult != ProcessCharResult.Escaping) { if(ch==0x1B) { _processCharResult = ProcessCharResult.Escaping; } else { //!!�v���Ԃ�̂��̂���������Ƃ��������������� _logger.Append(ch); if(GEnv.Frame.MacroIsRunning) AppendMacroBuffer(ch); if(ch < 0x20 || (ch>=0x80 && ch<0xA0)) _processCharResult = ProcessControlChar(ch); else _processCharResult = ProcessNormalChar(ch); } } else { if(ch=='\0') return; //�V�[�P���X����NULL�����������Ă���P�[�X���m�F���ꂽ _escapeSequence.Append(ch); bool end_flag = false; //escape sequence�̏I��肩�ǂ���������t���O if(_escapeSequence.Length==1) { //ESC+�P�����ł���ꍇ end_flag = ('0'<=ch && ch<='9') || ('a'<=ch && ch<='z') || ('A'<=ch && ch<='Z') || ch=='>' || ch=='=' || ch=='|' || ch=='}' || ch=='~'; } else if(_escapeSequence[0]==']') { //OSC�̏I�[��BEL��ST(String Terminator) end_flag = ch==0x07 || ch==0x9c; } else { end_flag = ('a'<=ch && ch<='z') || ('A'<=ch && ch<='Z') || ch=='@' || ch=='~' || ch=='|' || ch=='{'; } if(end_flag) { //�V�[�P���X�̂���� char[] seq = _escapeSequence.ToString().ToCharArray(); _logger.BeginEscapeSequence(); _logger.Append(seq, 0, seq.Length); _logger.CommitEscapeSequence(); _logger.Flush(); try { char code = seq[0]; _processCharResult = ProcessCharResult.Unsupported; //ProcessEscapeSequence�ŗ�O��������ŏ�Ԃ�Escaping�͂Ђǂ����ʂ�����̂� _processCharResult = ProcessEscapeSequence(code, seq, 1); if(_processCharResult==ProcessCharResult.Unsupported) throw new UnknownEscapeSequenceException(String.Format("ESC {0}", new string(seq))); } catch(UnknownEscapeSequenceException ex) { if(GEnv.Options.WarningOption!=Poderosa.Config.WarningOption.Ignore) GEnv.InterThreadUIService.UnsupportedEscapeSequence(GetDocument(), GEnv.Strings.GetString("Message.EscapesequenceTerminal.UnsupportedSequence")+ex.Message); } finally { _escapeSequence.Remove(0, _escapeSequence.Length); } } else _processCharResult = ProcessCharResult.Escaping; } }
protected override ProcessCharResult ProcessDECSET(string param, char code) { ProcessCharResult v = base.ProcessDECSET(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } bool set = code == 'h'; switch (param) { case "1047": //Alternate Buffer if (set) { SwitchBuffer(true); // XTerm doesn't clear screen. } else { ClearScreen(); SwitchBuffer(false); } return(ProcessCharResult.Processed); case "1048": //Save/Restore Cursor if (set) { SaveCursor(); } else { RestoreCursor(); } return(ProcessCharResult.Processed); case "1049": //Save/Restore Cursor and Alternate Buffer if (set) { SaveCursor(); SwitchBuffer(true); ClearScreen(); } else { // XTerm doesn't clear screen for enabling copy/paste from the alternate buffer. // But we need ClearScreen for emulating the buffer-switch. ClearScreen(); SwitchBuffer(false); RestoreCursor(); } return(ProcessCharResult.Processed); case "1000": case "1001": case "1002": case "1003": //ƒ}ƒEƒXŠÖŒW‚Í–³Ž‹ return(ProcessCharResult.Processed); case "1034": // Input 8 bits return(ProcessCharResult.Processed); case "3": //132 Column Mode return(ProcessCharResult.Processed); case "4": //Smooth Scroll ‚È‚ñ‚Ì‚±‚Æ‚â‚ç return(ProcessCharResult.Processed); case "5": SetReverseVideo(set); return(ProcessCharResult.Processed); case "6": //Origin Mode _scrollRegionRelative = set; return(ProcessCharResult.Processed); case "7": _wrapAroundMode = set; return(ProcessCharResult.Processed); case "12": //ˆê‰ž•ñ‚ ‚Á‚½‚Ì‚ÅBSETMODE‚Ì12‚È‚çƒ[ƒJƒ‹ƒGƒR[‚È‚ñ‚¾‚ª‚È return(ProcessCharResult.Processed); case "47": if (set) { SwitchBuffer(true); } else { SwitchBuffer(false); } return(ProcessCharResult.Processed); default: return(ProcessCharResult.Unsupported); } }
protected override ProcessCharResult ProcessAfterCSI(string param, char code) { ProcessCharResult v = base.ProcessAfterCSI(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } switch (code) { case 'd': ProcessLinePositionAbsolute(param); return(ProcessCharResult.Processed); case 'G': case '`': //CSI G‚ÍŽÀÛ‚É—ˆ‚½‚±‚Æ‚ª‚ ‚邪A‚±‚ê‚Í—ˆ‚½‚±‚Æ‚ª‚È‚¢B‚¢‚¢‚Ì‚©H ProcessLineColumnAbsolute(param); return(ProcessCharResult.Processed); case 'X': ProcessEraseChars(param); return(ProcessCharResult.Processed); case 'P': //_manipulator.DeleteChars(GetDocument().CaretColumn, ParseInt(param, 1)); GetDocument().MoveCursor(-1); GetDocument().VirtualScreen.WriteByte(0); return(ProcessCharResult.Processed); case 'p': return(SoftTerminalReset(param)); case '@': //ToDo: //_manipulator.InsertBlanks(GetDocument().CaretColumn, ParseInt(param, 1)); Console.WriteLine("ToDo: in Modul XTerm InsertBlands"); return(ProcessCharResult.Processed); case 'I': ProcessForwardTab(param); return(ProcessCharResult.Processed); case 'Z': ProcessBackwardTab(param); return(ProcessCharResult.Processed); case 'S': ProcessScrollUp(param); return(ProcessCharResult.Processed); case 'T': ProcessScrollDown(param); return(ProcessCharResult.Processed); case 'g': ProcessTabClear(param); return(ProcessCharResult.Processed); case 't': //!!ƒpƒ‰ƒ[ƒ^‚É‚æ‚Á‚Ä–³Ž‹‚µ‚Ă悢ꇂÆA‰ž“š‚ð•Ô‚·‚ׂ«ê‡‚ª‚ ‚éB‰ž“š‚Ì•Ô‚µ•û‚ª‚æ‚‚í‚©‚ç‚È‚¢‚Ì‚Å•Û—¯’† return(ProcessCharResult.Processed); case 'U': //‚±‚ê‚ÍSFU‚Å‚µ‚©Šm”F‚Å‚«‚Ä‚È‚¢ base.ProcessCursorPosition(GetDocument().TerminalHeight, 1); return(ProcessCharResult.Processed); case 'u': //SFU‚Å‚Ì‚ÝŠm”FB“Á‚Éb‚Í‘±‚•¶Žš‚ðŒJ‚è•Ô‚·‚炵‚¢‚ªAˆÓ–¡‚Ì‚ ‚é“®ì‚É‚È‚Á‚Ä‚¢‚é‚Æ‚±‚ë‚ðŒ©‚Ä‚¢‚È‚¢ case 'b': return(ProcessCharResult.Processed); default: return(ProcessCharResult.Unsupported); } }
protected override ProcessCharResult ProcessAfterCSI(string param, char code) { ProcessCharResult v = base.ProcessAfterCSI(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } switch (code) { case 'd': ProcessLinePositionAbsolute(param); return(ProcessCharResult.Processed); case 'G': case '`': ProcessLineColumnAbsolute(param); return(ProcessCharResult.Processed); case 'X': ProcessEraseChars(param); return(ProcessCharResult.Processed); case 'P': _manipulator.DeleteChars(_manipulator.CaretColumn, ParseInt(param, 1)); return(ProcessCharResult.Processed); case 'p': return(SoftTerminalReset(param)); case '@': _manipulator.InsertBlanks(_manipulator.CaretColumn, ParseInt(param, 1)); return(ProcessCharResult.Processed); case 'I': ProcessForwardTab(param); return(ProcessCharResult.Processed); case 'Z': ProcessBackwardTab(param); return(ProcessCharResult.Processed); case 'S': ProcessScrollUp(param); return(ProcessCharResult.Processed); case 'T': ProcessScrollDown(param); return(ProcessCharResult.Processed); case 'g': ProcessTabClear(param); return(ProcessCharResult.Processed); case 't': return(ProcessCharResult.Processed); case 'U': base.ProcessCursorPosition(GetConnection().TerminalHeight, 1); return(ProcessCharResult.Processed); case 'u': case 'b': return(ProcessCharResult.Processed); default: return(ProcessCharResult.Unsupported); } }
protected override ProcessCharResult ProcessDECSET(string param, char code) { ProcessCharResult v = base.ProcessDECSET(param, code); if (v != ProcessCharResult.Unsupported) { return(v); } if (param == "1047") { //Screen Buffer: return(ProcessCharResult.Processed); } else if (param == "1048" || param == "1049") { //Save/Restore Cursor return(ProcessCharResult.Processed); } else if (param == "1000" || param == "1001" || param == "1002" || param == "1003") { return(ProcessCharResult.Processed); } else if (param == "1034") { // Input 8 bits return(ProcessCharResult.Processed); } else if (param == "3") { //132 Column Mode return(ProcessCharResult.Processed); } else if (param == "4") { //Smooth Scroll return(ProcessCharResult.Processed); } else if (param == "6") { //Origin Mode _scrollRegionRelative = code == 'h'; return(ProcessCharResult.Processed); } else if (param == "7") { _wrapAroundMode = code == 'h'; return(ProcessCharResult.Processed); } else if (param == "12") { //һ���椢�ä��Τǡ�SETMODE��12�ʤ��`���륨���`�ʤ������ return(ProcessCharResult.Processed); } else if (param == "47") { if (code == 'h') { SaveScreen(); } else { RestoreScreen(); } return(ProcessCharResult.Processed); } else { return(ProcessCharResult.Unsupported); } }
public override void ProcessChar(char ch) { _logger = Logger; //_loggerはこのProcessCharの処理内でのみ有効。 if (_processCharResult != ProcessCharResult.Escaping) { if (ch == 0x1B) { _processCharResult = ProcessCharResult.Escaping; } else { //!!久しぶりのこのあたりを見るとけっこう汚い分岐だな _logger.Append(ch); if (GEnv.Frame.MacroIsRunning) { AppendMacroBuffer(ch); } if (ch < 0x20 || (ch >= 0x80 && ch < 0xA0)) { _processCharResult = ProcessControlChar(ch); } else { _processCharResult = ProcessNormalChar(ch); } } } else { if (ch == '\0') { return; //シーケンス中にNULL文字が入っているケースが確認された } _escapeSequence.Append(ch); bool end_flag = false; //escape sequenceの終わりかどうかを示すフラグ if (_escapeSequence.Length == 1) //ESC+1文字である場合 { end_flag = ('0' <= ch && ch <= '9') || ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || ch == '>' || ch == '=' || ch == '|' || ch == '}' || ch == '~'; } else if (_escapeSequence[0] == ']') //OSCの終端はBELかST(String Terminator) { end_flag = ch == 0x07 || ch == 0x9c; } else { end_flag = ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || ch == '@' || ch == '~' || ch == '|' || ch == '{'; } if (end_flag) //シーケンスのおわり { char[] seq = _escapeSequence.ToString().ToCharArray(); _logger.BeginEscapeSequence(); _logger.Append(seq, 0, seq.Length); _logger.CommitEscapeSequence(); _logger.Flush(); try { char code = seq[0]; _processCharResult = ProcessCharResult.Unsupported; //ProcessEscapeSequenceで例外が来た後で状態がEscapingはひどい結果を招くので _processCharResult = ProcessEscapeSequence(code, seq, 1); if (_processCharResult == ProcessCharResult.Unsupported) { throw new UnknownEscapeSequenceException(String.Format("ESC {0}", new string(seq))); } } catch (UnknownEscapeSequenceException ex) { if (GEnv.Options.WarningOption != Poderosa.Config.WarningOption.Ignore) { GEnv.InterThreadUIService.UnsupportedEscapeSequence(GetDocument(), GEnv.Strings.GetString("Message.EscapesequenceTerminal.UnsupportedSequence") + ex.Message); } } finally { _escapeSequence.Remove(0, _escapeSequence.Length); } } else { _processCharResult = ProcessCharResult.Escaping; } } }