From f74940efed4453b5156ccf58f379bf19a55c980d Mon Sep 17 00:00:00 2001 From: deathaxe Date: Fri, 16 Jan 2026 18:56:29 +0100 Subject: [PATCH] Add support for compact ActivityIndicator format --- sublime_lib/activity_indicator.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sublime_lib/activity_indicator.py b/sublime_lib/activity_indicator.py index c5b3911..1c7d569 100644 --- a/sublime_lib/activity_indicator.py +++ b/sublime_lib/activity_indicator.py @@ -13,7 +13,7 @@ __all__ = ['ActivityIndicator'] -class StatusTarget(metaclass=ABCMeta): # pragma: no cover +class StatusTarget(metaclass=ABCMeta): @abstractmethod def set(self, message: str) -> None: ... @@ -61,7 +61,7 @@ class ActivityIndicator: .. versionadded:: 1.4 """ - width: int = 10 + frames: str | list[str] = "⣷⣯⣟⡿⢿⣻⣽⣾" interval: int = 100 _lock: Lock @@ -75,7 +75,7 @@ def __init__( target: StatusTarget | sublime.View | sublime.Window, label: str | None = None, ) -> None: - self.label = label + self.label: str | None = label if isinstance(target, sublime.View): self._target = ViewTarget(target) @@ -146,12 +146,7 @@ def update(self) -> None: self._target.set(self.render(self._ticks)) def render(self, ticks: int) -> str: - status = ticks % (2 * self.width) - before = min(status, (2 * self.width) - status) - after = self.width - before - - return "{}[{}={}]".format( - self.label + ' ' if self.label else '', - " " * before, - " " * after, - ) + text = self.frames[ticks % len(self.frames)] + if self.label: + text += " " + self.label + return text