pulli 0.2.7__tar.gz → 0.2.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pulli
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Walk a directory tree, show git repos with status, and fast-forward the ones that are behind upstream.
5
5
  Author: Stefan Waldherr
6
6
  License-Expression: MIT
@@ -1,2 +1,2 @@
1
1
  """pulli — discover git repos under a root and report their status."""
2
- __version__ = "0.2.7"
2
+ __version__ = "0.2.9"
@@ -171,6 +171,20 @@ def _ahead_behind(node: RepoNode, C=lambda s, *c: s) -> str:
171
171
  return f"{b} {a}"
172
172
 
173
173
 
174
+ def _highlight_line(line: str) -> str:
175
+ """Cyan-wrap a whole line, surviving nested SGR resets.
176
+
177
+ Inner resets (e.g. the count's own cyan+bold) would end the outer cyan
178
+ mid-line and make the line render two-tone; re-apply the cyan after
179
+ each reset so the line stays one color throughout. Returns the input
180
+ unchanged when it carries no ANSI codes (color off) — nothing to
181
+ highlight then.
182
+ """
183
+ if "\x1b[" not in line:
184
+ return line
185
+ return _CYAN + line.replace(_RESET, _RESET + _CYAN) + _RESET
186
+
187
+
174
188
  def _repo_tail_parts(node: RepoNode, C) -> list[str]:
175
189
  """The status columns for a repo node, as a list of aligned-able parts.
176
190
 
@@ -337,7 +351,7 @@ def _build_flat_lines(
337
351
  # it — so the whole line is highlighted (cyan) instead of just the
338
352
  # count. Everything up to date stays quiet: no news takes no color.
339
353
  if n.behind and not n.error:
340
- line = C(line, _CYAN)
354
+ line = _highlight_line(line)
341
355
  lines.append(line)
342
356
  repo_line[id(n)] = len(lines) - 1
343
357
  repo_base[id(n)] = padded
@@ -465,7 +479,7 @@ class LiveTree:
465
479
  # Same highlight rule as _build_flat_lines: the whole line goes
466
480
  # cyan when the repo is behind — that is the actionable state.
467
481
  if self._flat and node.behind and not node.error:
468
- text = self._C(text, _CYAN)
482
+ text = _highlight_line(text)
469
483
  text = _clip_ansi(text, self._width)
470
484
  with self._lock:
471
485
  self._rewrite(i, text)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes