MCPcopy
hub / github.com/pallets/click / _handle_long_word

Method _handle_long_word

src/click/_textwrap.py:48–64  ·  src/click/_textwrap.py::TextWrapper._handle_long_word
(
        self,
        reversed_chunks: list[str],
        cur_line: list[str],
        cur_len: int,
        width: int,
    )

Source from the content-addressed store, hash-verified

46 class="st">"""
47
48 def _handle_long_word(
49 self,
50 reversed_chunks: list[str],
51 cur_line: list[str],
52 cur_len: int,
53 width: int,
54 ) -> None:
55 space_left = max(width - cur_len, 1)
56
57 if self.break_long_words:
58 last = reversed_chunks[-1]
59 cut = _truncate_visible(last, space_left)
60 res = last[len(cut) :]
61 cur_line.append(cut)
62 reversed_chunks[-1] = res
63 elif not cur_line:
64 cur_line.append(reversed_chunks.pop())
65
66 def _wrap_chunks(self, chunks: list[str]) -> list[str]:
67 class="st">"""Wrap chunks counting widths in visible characters.

Callers 1

_wrap_chunksMethod · 0.95

Calls 1

_truncate_visibleFunction · 0.85

Tested by

no test coverage detected