| 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 : /proc/thread-self/root/lib/python3.9/site-packages/prompt_toolkit/ |
Upload File : |
"""
Data structures for the selection.
"""
from enum import Enum
__all__ = [
"SelectionType",
"PasteMode",
"SelectionState",
]
class SelectionType(Enum):
"""
Type of selection.
"""
#: Characters. (Visual in Vi.)
CHARACTERS = "CHARACTERS"
#: Whole lines. (Visual-Line in Vi.)
LINES = "LINES"
#: A block selection. (Visual-Block in Vi.)
BLOCK = "BLOCK"
class PasteMode(Enum):
EMACS = "EMACS" # Yank like emacs.
VI_AFTER = "VI_AFTER" # When pressing 'p' in Vi.
VI_BEFORE = "VI_BEFORE" # When pressing 'P' in Vi.
class SelectionState:
"""
State of the current selection.
:param original_cursor_position: int
:param type: :class:`~.SelectionType`
"""
def __init__(
self,
original_cursor_position: int = 0,
type: SelectionType = SelectionType.CHARACTERS,
) -> None:
self.original_cursor_position = original_cursor_position
self.type = type
self.shift_mode = False
def enter_shift_mode(self) -> None:
self.shift_mode = True
def __repr__(self) -> str:
return "%s(original_cursor_position=%r, type=%r)" % (
self.__class__.__name__,
self.original_cursor_position,
self.type,
)