|
Server : LiteSpeed System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : elvh3918 ( 1528) PHP Version : 8.2.31 Disable Function : mail Directory : /usr/local/lib/python3.9/site-packages/prompt_toolkit/__pycache__/ |
a
��Sh�r � @ s� d Z ddlmZ ddlmZmZmZmZmZ ddl m
Z
ddlmZ ddl
mZmZmZmZmZ ddlmZ ddlmZ dd lmZmZ dd
lmZmZ ddlmZmZ ddl m!Z! dd
l"m#Z#m$Z$m%Z% ddl&m'Z'm(Z( ddl)m*Z*m+Z+m,Z,m-Z- e�rddl.m/Z/ ddl0m1Z1 ddgZ2dddddddddddddd d!�d"d#�Z3G d$d%� d%e4�Z5G d&d� dee6e*f �Z7G d'd� dee6e8f �Z9G d(d)� d)e�Z:G d*d� d�Z;d3dd,d-d.d/d0d1�d2d�Z<d+S )4z_
Renders the command line on the console.
(Redraws parts of the input line that were changed.)
� )�annotations)�FIRST_COMPLETED�Future�
ensure_future�sleep�wait)�deque)�Enum)�
TYPE_CHECKING�Any�Callable�Dict�Hashable)�get_app)�CursorShape)�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]r r r r �
Screen | Nonez
str | None�bool�_StyleStringToAttrsCache�_StyleStringHasStyleCacher �intztuple[Point, str | None])�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�� ddd�� ���� ��fdd�}d dd
������fdd�}d
dd��
fdd�}|s�� � |r�|s�|�
� |s�|r�|�kr�|tddd���� � |�� t
� }t|j|
�}tt|j|j�|
�}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 }�qf|�r||k �r|t|d |d���� � |�� �q||jk�rL|td|d d���|�rl|td|d���|�� n||�| jj���|�s�|�s�|�� � � |j�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.
�None�r8 c s � � d�dS )z'Wrapper around Output.reset_attributes.N� r; )�_output_reset_attributesr1 r; �A/usr/local/lib/python3.9/site-packages/prompt_toolkit/renderer.py�reset_attributesZ s z-_output_screen_diff.<locals>.reset_attributesr )�newr8 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? Z current_xZ current_y)�_output_cursor_backward�_output_cursor_forward�_output_cursor_upr. r>