MCPcopy
hub / github.com/donnemartin/gitsome / continuation_tokens

Method continuation_tokens

xonsh/ptk2/shell.py:244–273  ·  view source on GitHub ↗

Displays dots in multiline prompt

(self, width, line_number, is_soft_wrap=False)

Source from the content-addressed store, hash-verified

242 return PygmentsTokens(toks)
243
244 def continuation_tokens(self, width, line_number, is_soft_wrap=False):
245 """Displays dots in multiline prompt"""
246 if is_soft_wrap:
247 return ""
248 width = width - 1
249 dots = builtins.__xonsh__.env.get("MULTILINE_PROMPT")
250 dots = dots() if callable(dots) else dots
251 if dots is None:
252 return [(Token, " " * (width + 1))]
253 basetoks = self.format_color(dots)
254 baselen = sum(len(t[1]) for t in basetoks)
255 if baselen == 0:
256 return [(Token, " " * (width + 1))]
257 toks = basetoks * (width // baselen)
258 n = width % baselen
259 count = 0
260 for tok in basetoks:
261 slen = len(tok[1])
262 newcount = slen + count
263 if slen == 0:
264 continue
265 elif newcount <= n:
266 toks.append(tok)
267 else:
268 toks.append((tok[0], tok[1][: n - count]))
269 count = newcount
270 if n <= count:
271 break
272 toks.append((Token, " ")) # final space
273 return PygmentsTokens(toks)
274
275 def format_color(self, string, hide=False, force_string=False, **kwargs):
276 """Formats a color string using Pygments. This, therefore, returns

Callers

nothing calls this directly

Calls 3

format_colorMethod · 0.95
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected