����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib64
/
python3.6
/
curses
/
__pycache__
/
Filename :
textpad.cpython-36.pyc
back
Copy
3 � \�������������������@���sV���d�Z�ddlZddlZdd��ZG�dd��d�ZedkrRdd ��Zeje�Ze d e e���dS�)z:Simple textbox editing widget with Emacs-like keybindings.�����Nc�������������C���s����|�j�|d�|tj||�d���|�j||d�tj||�d���|�j||d�tj||�d���|�j�|d�|tj||�d���|�j||tj��|�j||tj��|�j||tj��|�j||tj ��dS�)z^Draw a rectangle with corners at the provided upper-left and lower-right coordinates. ����N) Zvline�cursesZ ACS_VLINEZhlineZ ACS_HLINE�addchZACS_ULCORNERZACS_URCORNERZACS_LRCORNERZACS_LLCORNER)�win�uly�ulxZlryZlrx��r����&/usr/lib64/python3.6/curses/textpad.py� rectangle���s����r ���c���������������@���sL���e�Zd�ZdZddd�Zdd��Zdd��Zd d ��Zdd��Zd d��Z ddd�Z dS�)�Textboxad��Editing 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 Fc�������������C���s.���||�_�||�_|�j���d|�_d�|�_|jd��d�S�)Nr���)r����insert_mode�_update_max_yx�stripspaces�lastcmdZkeypad)�selfr���r���r���r���r ����__init__+���s����zTextbox.__init__c�������������C���s&���|�j�j��\}}|d�|�_|d�|�_d�S�)Nr���)r���Zgetmaxyx�maxy�maxx)r���r���r���r���r���r ���r ���3���s���� zTextbox._update_max_yxc�������������C���s\���|�j����|�j}xHtjj|�jj||��tjjkrBt|�j|d��}P�n |dkrLP�|d�}qW�|S�)zuGo to the location of the first blank on the given line, returning the index of the last non-blank character.r���r���)r ���r���r����asciir����inchZSP�min)r����yZlastr���r���r ����_end_of_line8���s����zTextbox._end_of_linec�������������C���s����|�j����|�jj��\}}d�}x�||�jk�s0||�jk�r�|�jr@|�jj��}y|�jj|��W�n�tj k rf���Y�nX�|�j�s~tj j|��r�P�|}|�jj��\}}|d�kr||f}qW�|d�k r�|�jj|���d�S�)N) r ���r����getyxr���r���r���r���r���r����errorr����isprint�move)r����chr����xZbackyxZoldchr���r���r ����_insert_printable_charF���s$���� zTextbox._insert_printable_charc�������������C���sV��|�j����|�jj��\}}||�_tjj|�rJ||�jk�s<||�jk�rF|�j |���n|tjj krh|�jj|d���n�|tjjtj tjjtjfk�r|dkr�|�jj||d���nB|dkr�n8|�jr�|�jj|d�|�j|d����n|�jj|d�|�j��|tjjtjfk�rR|�jj����nL|tjjk�r"|�jj����n0|tjjk�rb|�j�rN|�jj||�j|���n|�jj||�j���n�|tjjtjfk�r�||�jk��r�|�jj||d���n ||�jk�r�n|�jj|d�d���n�|tjjk�r�dS�|tjjk�r|�jdk�r�dS�||�jk��rR|�jj|d�d���nF|tjjk�rZ|dk�r@|�j|�dk�r@|�jj���n|�jj||��|�jj���n�|tjjk�rt|�jj���n�|tjjtjfk�r�||�jk��rR|�jj|d�|��||�j|d��k�rR|�jj|d�|�j|d����nz|tjj k�r�|�jj!���n`|tjj"tj#fk�rR|dk�rR|�jj|d�|��||�j|d��k�rR|�jj|d�|�j|d����dS�)z!Process a single editing command.r���r���)$r ���r���r���r���r���r���r���r���r���r���ZSOHr���ZSTXZKEY_LEFTZBSZ KEY_BACKSPACEr���r���ZdelchZEOTZENQZACKZ KEY_RIGHTZBEL�NLZVTZdeletelnZclrtoeolZFF�refresh�SOZKEY_DOWNZSIZinsertlnZDLEZKEY_UP)r���r���r���r���r���r���r ���� do_command_���sr���� zTextbox.do_commandc�������������C���s����d}|�j����x�t|�jd��D�]�}|�jj|d��|�j|�}|dkrH|�jrHqxDt|�jd��D�]2}|�jrl||krlP�|tt j j |�jj||����}qXW�|�jdkr|d�}qW�|S�)z.Collect and return the contents of the window.��r���r���� )r ����ranger���r���r���r���r���r����chrr���r���r���)r����resultr����stopr���r���r���r ����gather����s���� " zTextbox.gatherNc�������������C���s@���x6|�j�j��}|r||�}|sq|�j|�s*P�|�j�j���qW�|�j��S�)z2Edit in the widget window and collect the results.)r���Zgetchr#���r!���r*���)r���Zvalidater���r���r���r ����edit����s���� zTextbox.edit)F)N)�__name__� __module__�__qualname__�__doc__r���r ���r���r���r#���r*���r+���r���r���r���r ���r������s��� Ar����__main__c�������������C���sf���d\}}d \}}|�j�|d�|d��tj||||�}t|�|d�|d�||�||���|�j���t|�j��S�) N� �������������������zUse Ctrl-G to end editing.r���)r1���r2���)r3���r4���)Zaddstrr���Znewwinr ���r!���r���r+���)ZstdscrZncolsZnlinesr���r���r���r���r���r ����test_editbox����s���� r6���zContents of text box:)r/���r���Zcurses.asciir ���r���r,���r6����wrapper�str�print�reprr���r���r���r ����<module>���s��� �,