← Back
Editing: key_processor.cpython-311.pyc
� �Ïc�D � �, � d Z ddlZddlmZmZ ddlmZ ddlmZm Z m Z mZmZm Z mZ ddlmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZ erdd lmZ ddlmZ g d�Z G d� d� � Z! e!dd�� � Z" G d� d� � Z# G d� d� � Z$dS )a% An :class:`~.KeyProcessor` receives callbacks for the keystrokes parsed from the input in the :class:`~prompt_toolkit.inputstream.InputStream` instance. The `KeyProcessor` will according to the implemented keybindings call the correct callbacks when new key presses are feed through `feed`. � N)�Task�sleep)�deque)� TYPE_CHECKING�Any�Deque� Generator�List�Optional�Union)�get_app)�EditingMode)�vi_navigation_mode)�Keys)�Event� )�Binding�KeyBindingsBase)�Application)�Buffer)�KeyProcessor�KeyPress� KeyPressEventc �` � e Zd ZdZd deeef dee ddfd�Zdefd�Z de defd �ZdS )r z� :param key: A `Keys` instance or text (one character). :param data: The received string on stdin. (Often vt100 escape codes.) N�key�data�returnc � � t |t � � st |� � dk sJ �|�t |t � � r|j }n|}|| _ || _ d S )Nr )� isinstancer �len�valuer r )�selfr r s �J/usr/lib/python3/dist-packages/prompt_toolkit/key_binding/key_processor.py�__init__zKeyPress.__init__'