gh-131507: Refactor screen and cursor position calculations (GH-131547) · python/cpython@4cc82ff · GitHub
Skip to content

Commit 4cc82ff

Browse files
authored
gh-131507: Refactor screen and cursor position calculations (GH-131547)
This is based off #131509.
1 parent 6131707 commit 4cc82ff

3 files changed

Lines changed: 96 additions & 81 deletions

File tree

Lib/_pyrepl/reader.py

Lines changed: 49 additions & 75 deletions

Lib/_pyrepl/types.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from collections.abc import Callable, Iterator
22

3-
Callback = Callable[[], object]
4-
SimpleContextManager = Iterator[None]
5-
KeySpec = str # like r"\C-c"
6-
CommandName = str # like "interrupt"
7-
EventTuple = tuple[CommandName, str]
8-
Completer = Callable[[str, int], str | None]
3+
type Callback = Callable[[], object]
4+
type SimpleContextManager = Iterator[None]
5+
type KeySpec = str # like r"\C-c"
6+
type CommandName = str # like "interrupt"
7+
type EventTuple = tuple[CommandName, str]
8+
type Completer = Callable[[str, int], str | None]
9+
type CharBuffer = list[str]
10+
type CharWidths = list[int]

Lib/_pyrepl/utils.py

Lines changed: 39 additions & 0 deletions

0 commit comments

Comments
 (0)