Skip to content

Commit 8bd3cd2

Browse files
committed
Add visual docs for PromptContent
1 parent 58ae9cb commit 8bd3cd2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/_pyrepl/content.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ class ContentFragment:
2525

2626
@dataclass(frozen=True, slots=True)
2727
class PromptContent:
28+
"""The prompt split into leading full-width lines and an inline portion.
29+
30+
For the common ``">>> "`` prompt (no newlines)::
31+
32+
>>> def greet(name):
33+
╰─╯
34+
text=">>> ", width=4, leading_lines=()
35+
36+
If ``sys.ps1`` contains newlines, e.g. ``"Python 3.13\\n>>> "``::
37+
38+
Python 3.13 ← leading_lines[0]
39+
>>> def greet(name):
40+
╰─╯
41+
text=">>> ", width=4
42+
"""
43+
2844
leading_lines: tuple[ContentFragment, ...]
2945
text: str
3046
width: int

0 commit comments

Comments
 (0)