o b2@s^dZddlmZmZddlmZmZmZddl m Z m Z GdddeZ ee GdddZ Gd d d ejZd Zd d iZGdddZGdddZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!Gdd d Z"d!d"Z#d#Z$Gd$d%d%Z%d&d'e$DZ&eeGd(d)d)ej'Z(e)e$e&D] \Z*Z+e,e(e*e+qGd*d+d+ej'Z-gd,Z.d-S).z? VT102 and VT220 terminal manipulation. @author: Jp Calderone ) Interface implementer)defer interfacesprotocol) iterbytes networkStringc@s4eZdZddZddZddZddZd d Zd S) ITerminalProtocolcCdS)zX Called with an L{ITerminalTransport} when a connection is established. N) transportr r ?/usr/lib/python3/dist-packages/twisted/conch/insults/insults.pymakeConnectionz ITerminalProtocol.makeConnectioncCr )a` A keystroke was received. Each keystroke corresponds to one invocation of this method. keyID is a string identifier for that key. Printable characters are represented by themselves. Control keys, such as arrows and function keys, are represented with symbolic constants on L{ServerProtocol}. Nr )keyIDmodifierr r r keystrokeReceivedrz#ITerminalProtocol.keystrokeReceivedcCr )z Called to indicate the size of the terminal. A terminal of 80x24 should be assumed if this method is not called. This method might not be called for real terminals. Nr )widthheightr r r terminalSize"rzITerminalProtocol.terminalSizecCr z Called when an unsupported control sequence is received. @type seq: L{str} @param seq: The whole control sequence which could not be interpreted. Nr seqr r r unhandledControlSequence*rz*ITerminalProtocol.unhandledControlSequencecCr )zh Called when the connection has been lost. reason is a Failure describing why. Nr )reasonr r r connectionLost2rz ITerminalProtocol.connectionLostN)__name__ __module__ __qualname__rrrrrr r r r r s   r c@s<eZdZddZddZddZddZd d Zd d Zd S)TerminalProtocolcCs||_|dSN)terminalconnectionMade)selfr!r r r r<s zTerminalProtocol.makeConnectioncCr )zA Called after a connection has been established. Nr r#r r r r"ArzTerminalProtocol.connectionMadecCdSr r )r#rrr r r rFz"TerminalProtocol.keystrokeReceivedcCr%r r )r#rrr r r rIr&zTerminalProtocol.terminalSizecCr%r r )r#rr r r rLr&z)TerminalProtocol.unhandledControlSequencecCr%r r r#rr r r rOr&zTerminalProtocol.connectionLostN) rrrrr"rrrrr r r r r:s rc@sdeZdZdVddZdVddZdVddZdVdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5ZdWd7d8Zd9d:Zd;d<Zd=d>Z d?d@Z!dAdBZ"dCdDZ#dEdFZ$dGdHZ%dVdIdJZ&dVdKdLZ'dVdMdNZ(dOdPZ)dQdRZ*dSdTZ+dUS)XITerminalTransportcCr )z- Move the cursor up n lines. Nr nr r r cursorUpTrzITerminalTransport.cursorUpcCr )z/ Move the cursor down n lines. Nr r*r r r cursorDownYrzITerminalTransport.cursorDowncCr )z2 Move the cursor right n columns. Nr r*r r r cursorForward^rz ITerminalTransport.cursorForwardcCr )z1 Move the cursor left n columns. Nr r*r r r cursorBackwardcrz!ITerminalTransport.cursorBackwardcCr )z? Move the cursor to the given line and column. Nr )columnliner r r cursorPositionhrz!ITerminalTransport.cursorPositioncCr )z' Move the cursor home. Nr r r r r cursorHomemrzITerminalTransport.cursorHomecCr )zS Move the cursor down one line, performing scrolling if necessary. Nr r r r r indexrrzITerminalTransport.indexcCr )zQ Move the cursor up one line, performing scrolling if necessary. Nr r r r r reverseIndexwrzITerminalTransport.reverseIndexcCr )zl Move the cursor to the first position on the next line, performing scrolling if necessary. Nr r r r r nextLine|rzITerminalTransport.nextLinecCr )zj Save the cursor position, character attribute, character set, and origin mode selection. Nr r r r r saveCursorrzITerminalTransport.saveCursorcCr )z Restore the previously saved cursor position, character attribute, character set, and origin mode selection. If no cursor state was previously saved, move the cursor to the home position. Nr r r r r restoreCursorrz ITerminalTransport.restoreCursorcCr )z6 Set the given modes on the terminal. Nr modesr r r setModesrzITerminalTransport.setModescCr )z8 Reset the given modes on the terminal. Nr )moder r r resetModesrzITerminalTransport.resetModescCr )zB Set the given DEC private modes on the terminal. Nr r9r r r setPrivateModesrz"ITerminalTransport.setPrivateModescCr )zD Reset the given DEC private modes on the terminal. Nr r9r r r resetPrivateModesrz$ITerminalTransport.resetPrivateModescCr )z Cause keypad to generate control functions. Cursor key mode selects the type of characters generated by cursor keys. Nr r r r r applicationKeypadModerz(ITerminalTransport.applicationKeypadModecCr )z= Cause keypad to generate normal characters. Nr r r r r numericKeypadModerz$ITerminalTransport.numericKeypadModecCr )z Select a character set. charSet should be one of CS_US, CS_UK, CS_DRAWING, CS_ALTERNATE, or CS_ALTERNATE_SPECIAL. which should be one of G0 or G1. Nr )charSetwhichr r r selectCharacterSetrz%ITerminalTransport.selectCharacterSetcCr )z0 Activate the G0 character set. Nr r r r r shiftInrzITerminalTransport.shiftIncCr )z0 Activate the G1 character set. Nr r r r r shiftOutrzITerminalTransport.shiftOutcCr )zG Shift to the G2 character set for a single character. Nr r r r r singleShift2rzITerminalTransport.singleShift2cCr )zG Shift to the G3 character set for a single character. Nr r r r r singleShift3rzITerminalTransport.singleShift3cGr )z Enabled one or more character attributes. Arguments should be one or more of UNDERLINE, REVERSE_VIDEO, BLINK, or BOLD. NORMAL may also be specified to disable all character attributes. Nr ) attributesr r r selectGraphicRenditionrz)ITerminalTransport.selectGraphicRenditioncCr )z@ Set a tab stop at the current cursor position. Nr r r r r horizontalTabulationSetrz*ITerminalTransport.horizontalTabulationSetcCr )zD Clear the tab stop at the current cursor position. Nr r r r r tabulationClearrz"ITerminalTransport.tabulationClearcCr )z& Clear all tab stops. Nr r r r r tabulationClearAllrz%ITerminalTransport.tabulationClearAllTcCr )z Make the current line the top or bottom half of a double-height, double-width line. If top is True, the current line is the top half. Otherwise, it is the bottom half. Nr )topr r r doubleHeightLinerz#ITerminalTransport.doubleHeightLinecCr )zK Make the current line a single-width, single-height line. Nr r r r r singleWidthLinerz"ITerminalTransport.singleWidthLinecCr )z< Make the current line a double-width line. Nr r r r r doubleWidthLinerz"ITerminalTransport.doubleWidthLinecCr )zV Erase from the cursor to the end of line, including cursor position. Nr r r r r eraseToLineEndrz!ITerminalTransport.eraseToLineEndcCr )zd Erase from the cursor to the beginning of the line, including the cursor position. Nr r r r r eraseToLineBeginningrz'ITerminalTransport.eraseToLineBeginningcCr )z/ Erase the entire cursor line. Nr r r r r eraseLinerzITerminalTransport.eraseLinecCr )za Erase from the cursor to the end of the display, including the cursor position. Nr r r r r eraseToDisplayEndrz$ITerminalTransport.eraseToDisplayEndcCr )zg Erase from the cursor to the beginning of the display, including the cursor position. Nr r r r r eraseToDisplayBeginningrz*ITerminalTransport.eraseToDisplayBeginningcCr )z+ Erase the entire display. Nr r r r r eraseDisplay rzITerminalTransport.eraseDisplaycCr )z Delete n characters starting at the cursor position. Characters to the right of deleted characters are shifted to the left. Nr r*r r r deleteCharacterrz"ITerminalTransport.deleteCharactercCr )z Insert n lines at the cursor position. Lines below the cursor are shifted down. Lines moved past the bottom margin are lost. This command is ignored when the cursor is outside the scroll region. Nr r*r r r insertLinerzITerminalTransport.insertLinecCr )z Delete n lines starting at the cursor position. Lines below the cursor are shifted up. This command is ignored when the cursor is outside the scroll region. Nr r*r r r deleteLine rzITerminalTransport.deleteLinecCr )zi Return a Deferred that fires with a two-tuple of (x, y) indicating the cursor position. Nr r r r r reportCursorPosition(rz'ITerminalTransport.reportCursorPositioncCr )z: Reset the terminal to its initial state. Nr r r r r reset-rzITerminalTransport.resetcCr rr rr r r r2rz+ITerminalTransport.unhandledControlSequenceNr)T),rrrr,r-r.r/r2r3r4r5r6r7r8r;r=r>r?r@rArDrErFrGrHrJrKrLrMrOrPrQrRrSrTrUrVrWrXrYrZr[r\rr r r r r(SsT          r(~stildec@s(eZdZdZdZZdZZdZZ dS)r:z$ ECMA 48 standardized modes N) rrr__doc__KEYBOARD_ACTIONKAMINSERTION_REPLACEMENTIRMLINEFEED_NEWLINELNMr r r r r:?s  r:c@s@eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdS) privateModesz' ANSI-Compatible Private Modes rr)rarbN)rrrrdERROR CURSOR_KEY ANSI_VT52COLUMNSCROLLSCREENORIGIN AUTO_WRAP AUTO_REPEATPRINTER_FORM_FEEDPRINTER_EXTENT CURSOR_MODEr r r r rk[srksCS_USsCS_UKs CS_DRAWINGs CS_ALTERNATEsCS_ALTERNATE_SPECIALsG0sG1sG2sG3r)rbrmroc@seZdZddZdS)VectorcCs||_||_dSr )xy)r#rrr r r __init__s zVector.__init__N)rrrrr r r r rs rcCsBtdd}|t|dWddS1swYdS)Nloga )openwritestr)sfr r r rs "r)UP_ARROW DOWN_ARROW RIGHT_ARROW LEFT_ARROWHOMEINSERTDELETEENDPGUPPGDN NUMPAD_MIDDLEF1F2F3F4F5F6F7F8F9F10F11F12ALTSHIFTCONTROLc@s>eZdZdZdeddfddZdefddZdefd d ZdS) _constz3 @ivar name: A string naming this constant namereturnNcCs ||_dSr r)r#rr r r rs z_const.__init__cCsd|jdS)N[]rr$r r r __repr__z_const.__repr__cCsd|jddS)Nrrascii)rencoder$r r r __bytes__z_const.__bytes__) rrrrdrrrbytesrr r r r rs rcCsg|]}t|qSr )rr).0_namer r r src@s eZdZdZdZdZdZdZdZe ddZ e ddZ dZ dZ d{d d Zd d Zd dZddZddZddZddZddZddZGdddZeZd|ddZd|d d!Zd|d"d#Zd|d$d%Zd&d'Zd(d)Zd*d+Zd,d-Z d.d/Z!d0d1Z"d2d3Z#d4d5Z$d6d7Z%d8d9Z&d:d;Z'dd?Z)d@dAZ*dBdCZ+dDdEZ,dFdGZ-dHdIZ.dJdKZ/dLdMZ0dNdOZ1dPdQZ2d}dSdTZ3dUdVZ4dWdXZ5dYdZZ6d[d\Z7d]d^Z8d_d`Z9dadbZ:dcddZ;d|dedfZd~dkdlZ?dmdnZ@dodpZAdqdrZBdsdtZCdudvZDdwdxZEdydzZFdS)ServerProtocolN dataPrcOs$|dur||_||_||_g|_dS)a @param protocolFactory: A callable which will be invoked with *a, **kw and should return an ITerminalProtocol implementor. This will be invoked when a connection to this ServerProtocol is established. @param a: Any positional arguments to pass to protocolFactory. @param kw: Any keyword arguments to pass to protocolFactory. N)protocolFactory protocolArgsprotocolKwArgs_cursorReports)r#rrkwr r r rs   zServerProtocol.__init__cCtd)Nz%Unimplemented: ServerProtocol.getHostNotImplementedErrorr$r r r getHostzServerProtocol.getHostcCr)Nz%Unimplemented: ServerProtocol.getPeerrr$r r r getPeerrzServerProtocol.getPeercCsZ|jdur+|j|ji|j|_z|j}Wn tyYnw||j_|j|dSdSr )rrrterminalProtocolfactoryAttributeErrorr)r#rr r r r"s   zServerProtocol.connectionMadecCst|D]v}|jdkr|dkrd|_q|j|dq|jdkr<|dkr+d|_g|_q|dkr3d|_qd|_||q|jdkri|dkrId|_q|sQ|dkrb|d |j||`d|_q|j |q|jdkrw| |d|_qt d dS) Nrr_escaped[sbracket-escapedOslow-function-escapedr`r Illegal state) rstaterrescBuf_handleShortControlSequenceisalpha_handleControlSequencejoinappend!_handleLowFunctionControlSequence ValueError)r#datachr r r dataReceiveds4       zServerProtocol.dataReceivedcCs|j||jdSr )rrr)r#rr r r r!rz*ServerProtocol._handleShortControlSequencecCsdd|}t|jt|dd|dddd}|dur%||dS|||j|dddS)N)getattrcontrolSequenceParserCSTgetdecoderr)r#bufrr r r r$s z%ServerProtocol._handleControlSequencecCs|j|dSr )rr)r#rr r r r0sz'ServerProtocol.unhandledControlSequencecCsN|j|j|j|jd}||}|dur|j|ddS|jd|dS)N)PQRSs)rrrrrrrr)r#r functionKeysrr r r r3s  z0ServerProtocol._handleLowFunctionControlSequencec@s\eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ dS)z$ServerProtocol.ControlSequenceParsercC,|dkr ||jddS||ddS)NrA)rrrr#protohandlerrr r r A<z&ServerProtocol.ControlSequenceParser.AcCr)NrB)rrrrr r r BBrz&ServerProtocol.ControlSequenceParser.BcCr)NrC)rrrrr r r CHrz&ServerProtocol.ControlSequenceParser.CcCr)NrD)rrrrr r r DNrz&ServerProtocol.ControlSequenceParser.DcCr)NrE)rrrrr r r ETrz&ServerProtocol.ControlSequenceParser.EcCr)NrF)rrrrr r r FZrz&ServerProtocol.ControlSequenceParser.FcCr)NrH)rrrrr r r H`rz&ServerProtocol.ControlSequenceParser.Hc Cs|js ||ddS|dr_|dd}|d}t|dkr+||ddS|\}}z t|t|}}WntyK||dYdSw|jd}||d|dfdS||ddS)Nrrra;rr)) rr startswithsplitlenintrpopcallback) r#rrrreportpartsPlPcdr r r Rfs       z&ServerProtocol.ControlSequenceParser.RcCs.|dkr||j|jdS||ddS)NrZ)rTABrrrr r r Zzsz&ServerProtocol.ControlSequenceParser.ZcCs|j|j|j|j|j|j|j|j|j|j |j |j |j |j d}|dr^|dd}zt|}WntyA||dYdSw||}|durU|||ddS||ddS||ddS)N)r)rarlrbrmrnrqrrrcrrrar`)rrrrrrrrrrrrrrrrrrrr)r#rrrmaprvsymbolicr r r tildes6     z*ServerProtocol.ControlSequenceParser.tildeN) rrrrrrrrrrrr rr r r r ControlSequenceParser;s rr)cC6|dksJt|jj|d|j_|d|fdS)Nr)rs[%dAmax cursorPosrrr#r+r r r r, zServerProtocol.cursorUpcC>|dksJt|jj||jjd|j_|d|fdS)Nr)s[%dBminrrtermSizerrr r r r- zServerProtocol.cursorDowncCr)Nr)s[%dC)rrrrrrr r r r.rzServerProtocol.cursorForwardcCr)Nr)rs[%dD)rrrrrr r r r/rzServerProtocol.cursorBackwardcCs|d|d|dfdS)Ns[%d;%dHr)r)r#r0r1r r r r2szServerProtocol.cursorPositioncCsd|j_|j_|ddS)Nrs)rrrrr$r r r r3szServerProtocol.cursorHomecCs,t|jjd|jjd|j_|ddS)Nr)sDrr$r r r r4szServerProtocol.indexcCs$t|jjdd|j_|ddS)Nr)rsMrr$r r r r5szServerProtocol.reverseIndexcCs4d|j_t|jjd|jjd|j_|ddS)Nrr) )rrrrrrr$r r r r6szServerProtocol.nextLinecCs"t|jj|jj|_|ddS)Ns7)rrrr_savedCursorPosrr$r r r r7szServerProtocol.saveCursorcCs|j|_|`|ddS)Ns8)r!rrr$r r r r8szServerProtocol.restoreCursorcC*ddd|D}|d|ddS)Nrcs|]}d|fVqdS%dNr rr<r r r z*ServerProtocol.setModes..rhrrr#r: modesBytesr r r r;zServerProtocol.setModescCr")Nrcsr#r$r r&r r r r'r(z1ServerProtocol.setPrivateModes..[?r)r*r+r r r r>zServerProtocol.setPrivateModescCr")Nrcsr#r$r r&r r r r'r(z,ServerProtocol.resetModes..rlr*r+r r r r=r-zServerProtocol.resetModescCr")Nrcsr#r$r r&r r r r'r(z3ServerProtocol.resetPrivateModes..r.r0r*r+r r r r?r/z ServerProtocol.resetPrivateModescC|ddS)Ns=rr$r r r r@rz$ServerProtocol.applicationKeypadModecCr1)Ns>rr$r r r rArz ServerProtocol.numericKeypadModecCs|tkrd}n |tkrd}ntd|tkrd}n |tkr d}n|tkr'd}n|tkr.d}n |tkr5d}ntd |d ||dS) N()z7`which' argument to selectCharacterSet must be G0 or G1rr012z0Invalid `charSet' argument to selectCharacterSetr_) G0G1rCS_UKCS_US CS_DRAWING CS_ALTERNATECS_ALTERNATE_SPECIALr)r#rBrCr r r rDs"z!ServerProtocol.selectCharacterSetcCr1)Nrr$r r r rErzServerProtocol.shiftIncCr1)Nrr$r r r rFrzServerProtocol.shiftOutcCr1)NsNrr$r r r rG rzServerProtocol.singleShift2cCr1)NsOrr$r r r rH rzServerProtocol.singleShift3cGs8g}|D] }|t|q|dd|ddS)Nrrm)rrrr)r#rIattrsrr r r rJsz%ServerProtocol.selectGraphicRenditioncCr1)NsHrr$r r r rKrz&ServerProtocol.horizontalTabulationSetcCr1)Nsrr$r r r rLrzServerProtocol.tabulationClearcCr1)Nsrr$r r r rMrz!ServerProtocol.tabulationClearAllTcCs |r |ddS|ddS)Ns#3s#4r)r#rNr r r rO szServerProtocol.doubleHeightLinecCr1)Ns#5rr$r r r rP&rzServerProtocol.singleWidthLinecCr1)Ns#6rr$r r r rQ)rzServerProtocol.doubleWidthLinecCr1)Nsrr$r r r rR,rzServerProtocol.eraseToLineEndcCr1)Nsrr$r r r rS/rz#ServerProtocol.eraseToLineBeginningcCr1)Nsrr$r r r rT2rzServerProtocol.eraseLinecCr1)Nsrr$r r r rU5rz ServerProtocol.eraseToDisplayEndcCr1)Nsrr$r r r rV8rz&ServerProtocol.eraseToDisplayBeginningcCr1)Nsrr$r r r rW;rzServerProtocol.eraseDisplaycC|d|fdS)Ns[%dPrrr r r rX>rzServerProtocol.deleteCharactercCrB)Ns[%dLrrr r r rYArzServerProtocol.insertLinecCrB)Ns[%dMrrr r r rZDrzServerProtocol.deleteLinecCsF|dur d|f}nd}|durd|f}nd}|d||fdS)Nr%rs[%b;%brr)r#firstlastr r r setScrollRegionGs  zServerProtocol.setScrollRegioncCs |dSr )rEr$r r r resetScrollRegionR z ServerProtocol.resetScrollRegioncCs"t}|j||d|S)Ns)rDeferredrrr)r#rr r r r[Us  z#ServerProtocol.reportCursorPositioncCs:d|j_|j_z|`Wn tyYnw|ddS)Nrsc)rrrr!rrr$r r r r\[s zServerProtocol.resetcCs>|rt|ts |d}||_|jd|ddSdS)Nzutf-8s r ) isinstancerr lastWriter rrrr#rr r r rds   zServerProtocol.writecCs|d|dS)Nr)rrrKr r r writeSequencekrzServerProtocol.writeSequencecCs||jdSr )r\r loseConnectionr$r r r rMnszServerProtocol.loseConnectioncCs0|jdurz |j|Wd|_dSd|_wdSr )rrr'r r r rrs zServerProtocol.connectionLostr r]r^)NN)Grrrrrr  BACKSPACErJrrrr scrollRegionrrrrr"rrrrrrrr,r-r.r/r2r3r4r5r6r7r8r;r>r=r?r@rArDrErFrGrHrJrKrLrMrOrPrQrRrSrTrUrVrWrXrYrZrErFr[r\rrLrMrr r r r rs    f            rc @seZdZdZdZdZdZddddddd d d d d d ZdddddZe e e e e dZdZd#ddZddZddZddZddZGdd d ZeZd!d"ZdS)$ClientProtocolNrsindexs reverseIndexsnextLines saveCursors restoreCursorsapplicationKeypadModesnumericKeypadModes singleShift2s singleShift3shorizontalTabulationSetsreset) rMr78=>Nrrcbracket-escape select-g0 select-g1select-height-width)rr2r3#)rrr4r5r6cOs|dur||_||_||_dS)aw @param terminalFactory: A callable which will be invoked with *a, **kw and should return an ITerminalTransport provider. This will be invoked when this ClientProtocol establishes a connection. @param a: Any positional arguments to pass to terminalFactory. @param kw: Any keyword arguments to pass to terminalFactory. N)terminalFactory terminalArgsterminalKwArgs)r#r]rrr r r rs  zClientProtocol.__init__cCs>|jdur|j|ji|j|_|j|j_|j|dSdSr )r]r^r_r!rrr$r r r r"s  zClientProtocol.connectionMadecCs,|jdurz |j|W|`dS|`wdSr )r!rr'r r r rs zClientProtocol.connectionLostcCsVg}t|D]}|jdkrz|dkr&|r"|jd||dd=d|_q|dkr@|r:|jd||dd=|jq|dkrZ|rT|jd||dd=|jq|dkrt|rn|jd||dd=|jq||q|jdkr|j |}|durd|_t |j| d q|j |}|dur||_q|jd|d|_q|jd kr|jdurg|_|s|d kr|d|j||`d|_q|j|q|jd kr|j|j ||td|_q|jd kr|j|j ||td|_q|jdkr||d|_qtd|r)|jd|dSdS)z Parse the given data from a terminal server, dispatching to event handlers defined by C{self.terminal}. rr_rNrr?r>rrXr`rYrZr[r)rrr!rrrFrEr/r_shortsrrr_longsr_escBufrrrD _charsetsr7r8_handleHeightWidthr)r#rtoWritebfNamerr r r rsn                  zClientProtocol.dataReceivedcCsNt|jt||dd}|dur|jd||dS|||j|dS)Nrr)rrrrrr!r)r#rr!rr r r rsz%ClientProtocol._handleControlSequencec@seZdZddZdD] \ZZeedq [ddZddZd d Z d d Z d dZ ddZ ddZ ddZddZddZddZdS)z$ClientProtocol.ControlSequenceParsercsd|fdd}|S)Ncursorcs\|s t|ddSzt|}Wnty$|d|YdSwt||dS)Nr)r)rrrr)r#rrrmrr+r r simples  z@ClientProtocol.ControlSequenceParser._makeSimple..simpler )rrhrlr rkr _makeSimples z0ClientProtocol.ControlSequenceParser._makeSimple))rUp)rDown)rForward)rBackwardz = _makeSimple(ch, fName)cCNz dd|dD}Wnty|d|dYdSw||dS)NcSg|]}t|qSr rr&r r r r0z:ClientProtocol.ControlSequenceParser.h..rrr))rrrr;r#rrrr:r r r h-  z&ClientProtocol.ControlSequenceParser.hcCrr)NcSrsr rtr&r r r r9ruz:ClientProtocol.ControlSequenceParser.l..rrl)rrrr=rvr r r ry6rxz&ClientProtocol.ControlSequenceParser.lcCs|d}t|dkr|dddSt|dkrQz|dr%t|d}nd}|dr2t|d}nd}WntyH|d|dYdSw|||dS|d|ddS)Nrr)rarrr)rrrErrr)r#rrrrptpbr r r r?s"    z&ClientProtocol.ControlSequenceParser.rcCN|s|dS|dkr|dS|dkr|dS|d|ddS)Nr5r6rK)rRrSrTrrr r r KT   z&ClientProtocol.ControlSequenceParser.KcCs |dSr )r3rr r r r^rGz&ClientProtocol.ControlSequenceParser.HcCr~)Nr5r6rJ)rUrVrWrrr r r Jarz&ClientProtocol.ControlSequenceParser.JcCT|s |ddSzt|}Wnty"|d|dYdSw||dS)Nr)rr)rXrrrr#rrrr+r r r Pk  z&ClientProtocol.ControlSequenceParser.PcCr)Nr)rL)rYrrrrr r r Lvrz&ClientProtocol.ControlSequenceParser.LcCr)Nr)rrQ)rZrrrrr r r Mrz&ClientProtocol.ControlSequenceParser.McCsJ|dkr|\}}|jd|d|dfdS|d|ddS)N6s[%d;%dRr)rn)r[r rr)r#rrrrrr r r r+s  z&ClientProtocol.ControlSequenceParser.nc Cs^|s |tdSg}|dD]}zt|}Wn ty!Ynw||q|j|dS)Nr)rJNORMALrrrr)r#rrrrArr r r rjs   z&ClientProtocol.ControlSequenceParser.mN)rrrrmrrhexecrwryr}rrrrrrr+rjr r r r rs         rcCsp|dkr |jddS|dkr|jddS|dkr#|jdS|dkr.|jdS|jd|dS)N3T4F5rs#)r!rOrPrQr)r#rgr r r resz!ClientProtocol._handleHeightWidthr )rrrr]r!rrcrarbr9r:r;r<r=rdrrr"rrrrrrer r r r rPsL A  rP)r r(r:rk FUNCTION_KEYSr:r9r;r<r=r7r8G2G3 UNDERLINE REVERSE_VIDEOBLINKBOLDrrrPN)/rdzope.interfacerrtwisted.internetrr iinternetrtwisted.python.compatrrr r ITransportr(CSIrr:rkr:r9r;r<r=r7r8rrrrrrrrr _KEY_NAMESrrProtocolrziprconstsetattrrP__all__r r r r sV)i8 2