]>
crepu.dev Git - config.git/blob - djavu-asus/emacs/elpy/rpc-venv/lib/python3.11/site-packages/click/_textwrap.py
b47dcbd4264e86715adfae1c5124c288b67a983e
3 from contextlib
import contextmanager
6 class TextWrapper(textwrap
.TextWrapper
):
9 reversed_chunks
: t
.List
[str],
10 cur_line
: t
.List
[str],
14 space_left
= max(width
- cur_len
, 1)
16 if self
.break_long_words
:
17 last
= reversed_chunks
[-1]
18 cut
= last
[:space_left
]
19 res
= last
[space_left
:]
21 reversed_chunks
[-1] = res
23 cur_line
.append(reversed_chunks
.pop())
26 def extra_indent(self
, indent
: str) -> t
.Iterator
[None]:
27 old_initial_indent
= self
.initial_indent
28 old_subsequent_indent
= self
.subsequent_indent
29 self
.initial_indent
+= indent
30 self
.subsequent_indent
+= indent
35 self
.initial_indent
= old_initial_indent
36 self
.subsequent_indent
= old_subsequent_indent
38 def indent_only(self
, text
: str) -> str:
41 for idx
, line
in enumerate(text
.splitlines()):
42 indent
= self
.initial_indent
45 indent
= self
.subsequent_indent
47 rv
.append(f
"{indent}{line}")