| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3.9/site-packages/prompt_toolkit/__pycache__/ |
Upload File : |
a
gaoo � @ s� d Z ddlmZmZmZmZmZ ddlmZ ddl m
Z
ddlmZm
Z
mZmZmZmZmZmZ ddlmZ ddlmZmZ ddlmZmZ dd lmZmZ dd
lm Z ddl!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z' dd
l(m)Z)m*Z*m+Z+m,Z, e�rddl-m.Z. ddl/m0Z0 ddgZ1de'e#ee&ee# ee2 e3e3ddee4eeee2 f d�dd�Z5G dd� de6�Z7G dd� dee2e)f �Z8G dd� dee2e3f �Z9G dd� de
�Z:G dd� d�Z;d"e'ee*ee, ee& dd �d!d�Z<dS )#z_
Renders the command line on the console.
(Redraws parts of the input line that were changed.)
� )�FIRST_COMPLETED�Future�
ensure_future�sleep�wait)�deque)�Enum)�
TYPE_CHECKING�Any�Callable�Deque�Dict�Hashable�Optional�Tuple)�get_app)�Point�Size)�FilterOrBool� to_filter)�AnyFormattedText�to_formatted_text)�
MouseHandlers)�Char�Screen�
WritePosition)�
ColorDepth�Output)�Attrs� BaseStyle�DummyStyleTransformation�StyleTransformation)�Application)�Layout�Renderer�print_formatted_text�Application[Any]�_StyleStringToAttrsCache�_StyleStringHasStyleCache)�app�output�screen�current_pos�color_depth�previous_screen�
last_style�is_done�full_screen�attrs_for_style_string�style_string_has_style�size�previous_width�returnc
s� |j |j �}
|j�|j}|j�|j�|j�|j�|j� |� � dd���fdd�� t
t
d�� ���� ��fdd�}tdd������fd d
�}tt
tf t
d��
fdd
�}|s�� � |r�|s�|�� |s�|r�|�kr�|t
ddd���� � |�� t� }t|j|
�}tt|j|j�|
�}d}t|�D �]}|j| }|j| }|j| }t�d ||��}t�d ||��}d}||k�r|| }|| }|j�p�d}|j|jk�s�|j|jk�r�|t
||d���||v �r�||| � ||� t
�j| �jd��||7 }�qr|�r&||k �r&|t
|d |d���� � |�� �q&||jk�rX|t
d|d d���|�rx|t
d|d���|�� n||�| jj���|�s�|�s�|� � � � |j!�s�|�r�|�!� ��fS )a�
Render the diff between this screen and the previous screen.
This takes two `Screen` instances. The one that represents the output like
it was during the last rendering and one that represents the current
output raster. Looking at these two `Screen` instances, this function will
render the difference by calling the appropriate methods of the `Output`
object that only paint the changes to the terminal.
This is some performance-critical code which is heavily optimized.
Don't change things without profiling first.
:param current_pos: Current cursor position.
:param last_style: The style string, used for drawing the last drawn
character. (Color/attributes.)
:param attrs_for_style_string: :class:`._StyleStringToAttrsCache` instance.
:param width: The width of the terminal.
:param previous_width: The width of the terminal during the last rendering.
N�r6 c s � � d�dS )z'Wrapper around Output.reset_attributes.N� r8 )�_output_reset_attributesr/ r8 �;/usr/lib/python3.9/site-packages/prompt_toolkit/renderer.py�reset_attributesV s z-_output_screen_diff.<locals>.reset_attributes)�newr6 c s� �j �j }}| j|krB�� �d| j| � d}�| j � | S | j|k rZ�|| j � |�d krz�d� �| j � n>| j |k s�|�d kr�� || j � n| j |kr��| j | � | S )z9Move cursor to this `new` point. Returns the given Point.�
r � �
��x�y)r<