PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` 3 .]/@s dZddlmZddlmZddlZddZdd 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/Zd0d1Zd2d3Zd4d5ZGd6d7d7ejZGd8d9d9eZdS):aThis implements an ANSI (VT100) terminal emulator as a subclass of screen. PEXPECT LICENSE This license is approved by the OSI and FSF as GPL-compatible. http://opensource.org/licenses/isc-license.txt Copyright (c) 2012, Noah Spurrier PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. )screen)FSMNcCs|jd}|j|jdS)Nr)memorywrite_ch input_symbol)fsmrr /usr/lib/python3.6/ANSI.pyDoEmit$s r cCs|jj|jdS)N)rappendr)rr r r DoStartNumber)sr cCs$|jj}||j}|jj|dS)N)rpoprr )rnsr r r DoBuildNumber-s  rcCs|jd}|jdS)Nr)r cursor_back)rrr r r DoBackOne3s rcCs&t|jj}|jd}|j|dS)Nr)intrrr)rcountrr r r DoBack8s rcCs|jd}|jdS)Nr)r cursor_down)rrr r r DoDownOne>s rcCs&t|jj}|jd}|j|dS)Nr)rrrr)rrrr r r DoDownCs rcCs|jd}|jdS)Nr)rcursor_forward)rrr r r DoForwardOneIs rcCs&t|jj}|jd}|j|dS)Nr)rrrr)rrrr r r DoForwardNs rcCs|jd}|jdS)Nr)rZcursor_up_reverse)rrr r r DoUpReverseTs rcCs|jd}|jdS)Nr)r cursor_up)rrr r r DoUpOneYs rcCs&t|jj}|jd}|j|dS)Nr)rrrr)rrrr r r DoUp^s rcCs6t|jj}t|jj}|jd}|j||dS)Nr)rrr cursor_home)rcrrr r r DoHomeds r#cCs"d}d}|jd}|j||dS)Nrr)rr )rr!r"rr r r DoHomeOriginks r$cCs|jd}|jdS)Nr)r erase_down)rrr r r DoEraseDownrs r&cCsPt|jj}|jd}|dkr*|jn"|dkr<|jn|dkrL|jdS)Nrr)rrrr%Zerase_upZ erase_screen)rargrr r r DoErasews   r)cCs|jd}|jdS)Nr)rerase_end_of_line)rrr r r DoEraseEndOfLines r+cCsPt|jj}|jd}|dkr*|jn"|dkr<|jn|dkrL|jdS)Nrrr')rrrr*Zerase_start_of_line erase_line)rr(rr r r DoEraseLines   r-cCs|jd}|jdS)Nr)rZ scroll_screen)rrr r r DoEnableScrolls r.cCs|jd}|jdS)Nr)rZcursor_save_attrs)rrr r r DoCursorSaves r/cCs|jd}|jdS)Nr)rZcursor_restore_attrs)rrr r r DoCursorRestores r0cCs6|jd}t|jj}t|jj}|j||dS)Nr)rrrZscroll_screen_rows)rrZr2Zr1r r r DoScrollRegions r1cCs|jd}|jj}dS)Nr)rr)rrmoder r r DoModes r3cCsB|jd}|g|_tdd}|j|jd|jd|jdS)Nrloga, )ropenwriterZ current_stateclose)rrZfoutr r r DoLogs   r;c@seZdZdZdddZdS)termzThis class is an abstract, generic terminal. This does nothing. This is a placeholder that provides a common base class for other terminals such as an ANSI terminal. PcOstjj|||f||dS)N)r__init__)selfr"r!argskwargsr r r r?sz term.__init__N)r=r>)__name__ __module__ __qualname____doc__r?r r r r r<sr<c@sZeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ dS)ANSIzThis class implements an ANSI (VT100) terminal. It is a stream filter that recognizes ANSI terminal escape sequences and maintains the state of a screen object. r=r>cOsrtj|||f||tjd|g|_|jjtd|jjdtd|jjdddd|jjdtd|jjdddd|jjdddd|jj dddd|jj dddd|jjd dt d|jjd dt d|jjd dt d|jjd dt d|jjd dt d|jjdddd|jjdddd|jjddd|jjdddd|jjddt d|jjddtd|jjddtd|jjddtd|jjddtd|jjddtd|jjddtd|jjddtd|jjdd|jd|jjdddd|jj tjdtd|jj tjdtd|jjddtd|jjddtd|jjddtd|jjddtd|jjddtd|jjddtd|jjddt d|jjdd|jd|jjd d|j!d|jj tjdtd!|jj tjd!td!|jjdd!|j"d|jjd"d!|j"d|jjd#ddd$|jjd$td|jj tjd$td%|jj tjd%td%|jjd%td|jjdd%t#d|jjd&d%t#d|jjdd%t$d|jjdd%|jd|jjd d%|j!d|jjd#d%dd'|jjd'td|jj tjd'td(|jj tjd(td(|jjd(td|jjdd(|jd|jjd d(|j!d|jjd#d(dd'dS))NZINITZESC(ZG0SCS)ZG1SCSZAB01278M><=#ZGRAPHICS_POUND[ZELBHDBCAJKr"m?ZMODECRAPZNUMBER_1lqZ MODECRAP_NUMh;Z SEMICOLONZNUMBER_2fZ SEMICOLON_XZNUMBER_X)%r<r?rstateZset_default_transitionr;Zadd_transition_anyr Zadd_transitionZadd_transition_listr/r0rr$rrrrr&r+r.do_sgrstringZdigitsr rrrrrr)r-r3 do_decsca do_modecrapr#r1)r@r"r!rArBr r r r?s|z ANSI.__init__cCs$t|tr|j|}|jj|dS)z4Process a single character. Called by :meth:`write`.N) isinstancebytes_decoderaprocess)r@r!r r r ris  z ANSI.processcCs|j|dS)N)r9)r@r\r r r process_listszANSI.process_listcCs0t|tr|j|}x|D]}|j|qWdS)zaProcess text, writing it to the virtual screen while handling ANSI escape codes. N)rfrgrhri)r@sr!r r r r9#s   z ANSI.writecCsdS)Nr )r@r r r flush,sz ANSI.flushcCst|tr|j|}|d}|dkr0|jdS|dkrD|jdS|ttjkr^|jdS|j |j |j ||j }|j }|j ||j kr|j ||j kr|j|j dn|j|j|j d|jdS)zThis puts a character at the current cursor position. The cursor position is moved forward with wrap-around, but no scrolling is done if the cursor hits the lower-right corner of the screen. r Nr7r)rfrgrhZcrZcrlfchrrZBSrZput_absZcur_rZcur_crrr Z scroll_upr,)r@ZchZold_rZold_cr r r r/s.    z ANSI.write_chcCs|jd}|g|_dS)z&Select Graphic Rendition, e.g. color. rN)r)r@rrr r r rbPs z ANSI.do_sgrcCs|jd}|g|_dS)z'Select character protection attribute. rN)r)r@rrr r r rdUs zANSI.do_decscacCs|jd}|g|_dS)zHandler for [?h and [?l. If anyone wanted to actually use these, they'd need to add more states to the FSM rather than just improve or override this method. rN)r)r@rrr r r reZs zANSI.do_modecrapN)r=r>) rCrDrErFr?rirjr9rlrrbrdrer r r r rGs S !rG)rFrrrcr r rrrrrrrrrrr#r$r&r)r+r-r.r/r0r1r3r;r<rGr r r r s: