AlkantarClanX12

Your IP : 3.135.206.212


Current Path : /proc/self/root/opt/alt/python39/lib64/python3.9/curses/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python39/lib64/python3.9/curses/__pycache__/textpad.cpython-39.pyc

a

R�f��@sVdZddlZddlZdd�ZGdd�d�ZedkrRdd	�Ze�e�Ze	d
e
e��dS)z:Simple textbox editing widget with Emacs-like keybindings.�NcCs�|�|d|tj||d�|�||dtj||d�|�||dtj||d�|�|d|tj||d�|�||tj�|�||tj�|�||tj�|�||tj	�dS)z^Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    �N)
Zvline�cursesZ	ACS_VLINEZhlineZ	ACS_HLINE�addchZACS_ULCORNERZACS_URCORNERZACS_LRCORNERZACS_LLCORNER)�win�uly�ulxZlryZlrx�r�3/opt/alt/python39/lib64/python3.9/curses/textpad.py�	rectanglesr
c@sLeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dS)�TextboxadEditing widget using the interior of a window object.
     Supports the following Emacs-like key bindings:

    Ctrl-A      Go to left edge of window.
    Ctrl-B      Cursor left, wrapping to previous line if appropriate.
    Ctrl-D      Delete character under cursor.
    Ctrl-E      Go to right edge (stripspaces off) or end of line (stripspaces on).
    Ctrl-F      Cursor right, wrapping to next line when appropriate.
    Ctrl-G      Terminate, returning the window contents.
    Ctrl-H      Delete character backward.
    Ctrl-J      Terminate if the window is 1 line, otherwise insert newline.
    Ctrl-K      If line is blank, delete it, otherwise clear to end of line.
    Ctrl-L      Refresh screen.
    Ctrl-N      Cursor down; move down one line.
    Ctrl-O      Insert a blank line at cursor location.
    Ctrl-P      Cursor up; move up one line.

    Move operations do nothing if the cursor is at an edge where the movement
    is not possible.  The following synonyms are supported where possible:

    KEY_LEFT = Ctrl-B, KEY_RIGHT = Ctrl-F, KEY_UP = Ctrl-P, KEY_DOWN = Ctrl-N
    KEY_BACKSPACE = Ctrl-h
    FcCs.||_||_|��d|_d|_|�d�dS�Nr)r�insert_mode�_update_max_yx�stripspaces�lastcmdZkeypad)�selfrr
rrr	�__init__+szTextbox.__init__cCs&|j��\}}|d|_|d|_dSr)rZgetmaxyx�maxy�maxx)rrrrrr	r3s
zTextbox._update_max_yxcCsX|��|j}tj�|j�||��tjjkr@t|j|d�}qTn
|dkrJqT|d}q|S)zuGo to the location of the first blank on the given line,
        returning the index of the last non-blank character.rr)rrr�asciir�inchZSP�min)r�yZlastrrr	�_end_of_line8s
zTextbox._end_of_linecCs�|��|j��\}}d}||jks.||jkr�|jr>|j��}z|j�|�Wntj	ybYn0|jr�tj
�|�sxq�|}|j��\}}|dur||f}q|dur�|jj|�dS)N)
rr�getyxrrr
rrr�errorr�isprint�move)r�chr�xZbackyxZoldchrrr	�_insert_printable_charFs$

zTextbox._insert_printable_charcCsV|��|j��\}}||_tj�|�rJ||jks<||jkrF|�	|��n|tjj
krh|j�|d��n�|tjjtj
tjjtjfv�r|dkr�|j�||d�nB|dkr�n8|jr�|j�|d|�|d��n|j�|d|j�|tjjtjfv�rR|j���nL|tjjk�r"|j���n0|tjjk�rb|j�rN|j�||�|��n|j�||j��n�|tjjtjfv�r�||jk�r�|j�||d�n ||jk�r�n|j�|dd��n�|tjjk�r�dS|tjjk�r|jdk�r�dS||jk�rR|j�|dd��nF|tjjk�rZ|dk�r@|�|�dk�r@|j��n|j�||�|j��n�|tjjk�rt|j��n�|tjjtjfv�r�||jk�rR|j�|d|�||�|d�k�rR|j�|d|�|d��nz|tjj k�r�|j�!�n`|tjj"tj#fv�rR|dk�rR|j�|d|�||�|d�k�rR|j�|d|�|d��dS)z!Process a single editing command.rr)$rrrrrrrrrr ZSOHrZSTXZKEY_LEFTZBSZ
KEY_BACKSPACErrZdelchZEOTZENQZACKZ	KEY_RIGHTZBEL�NL�VTZdeletelnZclrtoeolZFF�refreshZSOZKEY_DOWNZSIZinsertlnZDLEZKEY_UP)rrrrrrr	�
do_command_sr
zTextbox.do_commandc
Cs�d}|��t|jd�D]�}|j�|d�|�|�}|dkrF|jrFqt|jd�D]4}|jrj||krjq�|tt	j
�
|j�||���}qT|jdkr|d}q|S)z.Collect and return the contents of the window.�rr�
)r�rangerrrrrr�chrrrr)r�resultr�stoprrrr	�gather�s
 

zTextbox.gatherNcCs<|j��}|r||�}|sq|�|�s(q4|j��q|��S)z2Edit in the widget window and collect the results.)rZgetchr$r#r+)rZvalidaterrrr	�edit�s

zTextbox.edit)F)N)�__name__�
__module__�__qualname__�__doc__rrrr r$r+r,rrrr	rs
Ar�__main__cCsfd\}}d\}}|�|d|d�t�||||�}t||d|d||||�|��t|���S)N)�	�)���zUse Ctrl-G to end editing.r)ZaddstrrZnewwinr
r#rr,)ZstdscrZncolsZnlinesrrrrrr	�test_editbox�s r7zContents of text box:)r0rZcurses.asciir
rr-r7�wrapper�str�print�reprrrrr	�<module>s
,