← Back
Editing: menus.cpython-311.pyc
� �Ïc�j � �& � d dl Z d dlmZ d dlmZmZmZmZmZm Z m Z mZmZm Z mZ d dlmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d d lmZmZmZmZmZ d d l m!Z!m"Z"m#Z# d dl$m%Z% d dl&m'Z' d d l(m)Z)m*Z* d dl+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9 erd dl:m;Z;m<Z< ddgZ=e%Z> G d� de5� � Z? d)dede@deAde@de!f d�ZBd e!d!eAdee!eAf fd"�ZC G d#� de.� � ZD G d$� d%e5� � ZE G d&� de/� � ZF G d'� d(e5� � ZGdS )*� N)�zip_longest)� TYPE_CHECKING�Callable�Dict�Iterable�List�Optional�Sequence�Tuple�TypeVar�Union�cast)�WeakKeyDictionary�WeakValueDictionary)�get_app)�CompletionState)� Completion)�Point)� Condition�FilterOrBool�has_completions�is_done� to_filter)�StyleAndTextTuples�fragment_list_width�to_formatted_text)� KeyPressEvent)�explode_text_fragments)� MouseEvent�MouseEventType)� get_cwidth� )�ConditionalContainer�HSplit� ScrollOffsets�Window)�GetLinePrefixCallable� UIContent� UIControl)� Dimension)�ScrollbarMargin)�KeyBindings�NotImplementedOrNone�CompletionsMenu�MultiColumnCompletionsMenuc �� � e Zd ZdZdZdefd�Zdedee fd�Z deded ed ee dee f d�Zdededefd �Z dedefd�Zdededefd�Zdededefd�Zdedededefd�Zdeddfd�ZdS )�CompletionsMenuControlaJ Helper for drawing the complete menu to the screen. :param scroll_offset: Number (integer) representing the preferred amount of completions to be displayed before and after the current one. When this is a very high number, the current completion will be shown in the middle most of the time. � �returnc � � dS �NF� ��selfs �=/usr/lib/python3/dist-packages/prompt_toolkit/layout/menus.py� has_focusz CompletionsMenuControl.has_focusJ � � ��u� �max_available_widthc � � t � � j j }|r1| � d|� � }| � d|� � }||z S dS )Ni� r )r �current_buffer�complete_state�_get_menu_width�_get_menu_meta_width)r8 r= r@ � menu_width�menu_meta_widths r9 �preferred_widthz&CompletionsMenuControl.preferred_widthM sS � � ���1�@��� ��-�-�c�>�B�B�J�"�7�7��^�L�L�O���/�/��1r<