AlkantarClanX12

Your IP : 3.149.239.79


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/curses/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/curses/__pycache__/textpad.cpython-311.pyc

�

c��f����dZddlZddlZd�ZGd�d��Zedkr*d�Zeje��Ze	de
e����dSdS)	z:Simple textbox editing widget with Emacs-like keybindings.�Nc�f�|�|dz|tj||z
dz
��|�||dztj||z
dz
��|�||dztj||z
dz
��|�|dz|tj||z
dz
��|�||tj��|�||tj��|�||tj��|�||tj	��dS)z^Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    �N)
�vline�curses�	ACS_VLINE�hline�	ACS_HLINE�addch�ACS_ULCORNER�ACS_URCORNER�ACS_LRCORNER�ACS_LLCORNER)�win�uly�ulx�lry�lrxs     �5/opt/alt/python311/lib64/python3.11/curses/textpad.py�	rectanglers
���I�I�c�!�e�S�&�*�C�#�I��M�:�:�:��I�I�c�3�q�5�&�*�C�#�I��M�:�:�:��I�I�c�3�q�5�&�*�C�#�I��M�:�:�:��I�I�c�!�e�S�&�*�C�#�I��M�:�:�:��I�I�c�3��+�,�,�,��I�I�c�3��+�,�,�,��I�I�c�3��+�,�,�,��I�I�c�3��+�,�,�,�,�,�c�@�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	dd
�Z
d	S)
�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
    Fc��||_||_|���d|_d|_|�d��dS�Nr)r�insert_mode�_update_max_yx�stripspaces�lastcmd�keypad)�selfrrs   r�__init__zTextbox.__init__+sE�����&����������������
�
�1�
�
�
�
�
rc�f�|j���\}}|dz
|_|dz
|_dSr)r�getmaxyx�maxy�maxx)r r$r%s   rrzTextbox._update_max_yx3s3���X�&�&�(�(�
��d��1�H��	��1�H��	�	�	rc� �|���|j}	tj�|j�||����tjjkrt|j|dz��}n
|dkrn|dz
}�q|S)zuGo to the location of the first blank on the given line,
        returning the index of the last non-blank character.Trr)rr%r�asciir�inch�SP�min)r �y�lasts   r�_end_of_linezTextbox._end_of_line8s���	
�������y��	��|�!�!�$�(�-�-��4�"8�"8�9�9�V�\�_�L�L��4�9�d�1�f�-�-���������!�8�D�
	��rc� �|���|j���\}}d}||jks||jkr�|jr|j���}	|j�|��n#tj	$rYnwxYw|jrtj
�|��sn:|}|j���\}}|�||f}||jk��||jk��|�|jj|�dSdS�N)
rr�getyxr$r%rr(r
r�errorr'�isprint�move)r �chr+�x�backyx�oldchs      r�_insert_printable_charzTextbox._insert_printable_charFs&������������!�!���A����$�)�m�m�q�4�9�}�}���
(���
�
����
�����r�"�"�"�"���<�
�
�
���
�����#�
�6�<�+?�+?��+F�+F�
���B��X�^�^�%�%�F�Q���~��A���!�$�)�m�m�q�4�9�}�}�$���D�H�M�6�"�"�"�"��s�*B�B�Bc�
�|���|j���\}}||_tj�|��r-||jks||jkr|�	|���n�|tjj
kr|j�|d���n�|tjjtj
tjjtjfvr�|dkr|j�||dz
��nf|dkrn_|jr5|j�|dz
|�|dz
����n#|j�|dz
|j��|tjjtjfvr|j����n�|tjjkr|j����nY|tjjkrY|jr0|j�||�|�����n
|j�||j���n�|tjjtjfvrX||jkr |j�||dz���n�||jkr�n�|j�|dzd���nt|tjjkrdS|tjjkr8|jdkrdS||jkr|j�|dzd���n|tjjkrp|dkr4|�|��dkr|j����n�|j�||��|j����n�|tjjkr|j����n[|tjjtjfvrz||jkrn|j�|dz|��||�|dz��kr4|j�|dz|�|dz����n�|tjj kr|j�!��n�|tjj"tj#fvrt|dkrn|j�|dz
|��||�|dz
��kr4|j�|dz
|�|dz
����dS)z!Process a single editing command.rr)$rrr0rrr'r2r$r%r8�SOHr3�STX�KEY_LEFT�BS�
KEY_BACKSPACErr-�delch�EOT�ENQ�ACK�	KEY_RIGHT�BEL�NL�VT�deleteln�clrtoeol�FF�refresh�SO�KEY_DOWN�SI�insertln�DLE�KEY_UP)r r4r+r5s    r�
do_commandzTextbox.do_command_s�������������!�!���A�����<����#�#�9	?��4�9�}�}��D�I�
�
��+�+�B�/�/�/��
�6�<�#�
#�
#��H�M�M�!�Q�����
�F�L�$�V�_�f�l�o�f�FZ�[�
[�
[��1�u�u���
�
�a��1��%�%�%�%��a�����!�
.���
�
�a��c�4�#4�#4�Q�q�S�#9�#9�:�:�:�:���
�
�a��c�4�9�-�-�-��f�l�o�v�';�<�<�<����� � � ��
�6�<�#�
#�
#��H�N�N�����
�6�<�#�
#�
#���
,���
�
�a��!2�!2�1�!5�!5�6�6�6�6���
�
�a���+�+�+�+�
�F�L�$�f�&6�7�
7�
7��4�9�}�}���
�
�a��1��%�%�%�%��d�i������
�
�a��c�1�%�%�%�%�
�6�<�#�
#�
#��1�
�6�<�?�
"�
"��y�A�~�~��q��T�Y�����
�
�a��c�1�%�%�%��
�6�<�?�
"�
"��A�v�v�$�+�+�A�.�.�!�3�3���!�!�#�#�#�#���
�
�a��#�#�#���!�!�#�#�#�#�
�6�<�?�
"�
"��H�������
�F�L�O�V�_�5�
5�
5��4�9�}�}���
�
�a��c�1�%�%�%��t�(�(��1��-�-�-�-��H�M�M�!�A�#�t�'8�'8��1��'=�'=�>�>�>��
�6�<�?�
"�
"��H�������
�F�L�$�f�m�4�
4�
4��1�u�u���
�
�a��c�1�%�%�%��t�(�(��1��-�-�-�-��H�M�M�!�A�#�t�'8�'8��1��'=�'=�>�>�>��qrc���d}|���t|jdz��D]�}|j�|d��|�|��}|dkr|jr�@t|jdz��D]Y}|jr||krnI|ttj
�
|j�||������z}�Z|jdkr|dz}��|S)z.Collect and return the contents of the window.�rr�
)r�ranger$rr3r-rr%�chrrr'r()r �resultr+�stopr5s     r�gatherzTextbox.gather�s������������t�y��{�#�#�
	'�
	'�A��H�M�M�!�Q�����$�$�Q�'�'�D��q�y�y�T�-�y���4�9�Q�;�'�'�
O�
O���#���D����E��#�f�l�&8�&8�����q�!�9L�9L�&M�&M�"N�"N�N����y�1�}�}��$�����
rNc���	|j���}|r||��}|s�*|�|��sn|j����Y|���S)z2Edit in the widget window and collect the results.)r�getchrQrJrY)r �validater4s   r�editzTextbox.edit�sx��	�����!�!�B��
"��X�b�\�\���
���?�?�2�&�&�
���H������	��{�{�}�}�r)Fr/)�__name__�
__module__�__qualname__�__doc__r!rr-r8rQrYr]�rrrrs���������.�������
���#�#�#�2?�?�?�B���"�����rr�__main__c� �d\}}d\}}|�|dz
|d��tj||||��}t||dz
|dz
||z||z��|���t|�����S)N)�	�)���zUse Ctrl-G to end editing.r)�addstrr�newwinrrJrr])�stdscr�ncols�nlinesrrrs      r�test_editboxro�s����
��v����S��
�
�c�!�e�S�">�?�?�?��m�F�E�3��4�4���&�#�a�%��Q���f��c�E�k�B�B�B��������s�|�|� � �"�"�"rzContents of text box:)rar�curses.asciirrr^ro�wrapper�str�print�reprrbrr�<module>rus���@�@�
�
�
�
�����-�-�-�i�i�i�i�i�i�i�i�V�z���#�#�#��&�.��
&�
&�C�	�E�
!�4�4��9�9�-�-�-�-�-��r