diff options
| author | historia <historiavg@proton.me> | 2026-08-25 18:27:50 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 18:27:50 -0400 |
| commit | 64e9940d43fad1bc5908b39673b03e4fdc1e8f2f (patch) | |
| tree | 145271b5d98efb1659a08e4ba883741df55ba299 /app/ui | |
| parent | 4b49797b4d57c2d2cf63472636622a7a6280a38e (diff) | |
| download | tts-audiobook-generator-64e9940d43fad1bc5908b39673b03e4fdc1e8f2f.tar.gz | |
fix(tui): loading bar overflow during build
Diffstat (limited to 'app/ui')
| -rw-r--r-- | app/ui/taskview.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/ui/taskview.py b/app/ui/taskview.py index ea72a86..c4fd35e 100644 --- a/app/ui/taskview.py +++ b/app/ui/taskview.py @@ -441,8 +441,11 @@ class TaskView: # -- progress bar ---------------------------------------------- if self._progress is not None and self.phase not in _TERMINAL: done, total = self._progress + label = _progress_label(self._progress, self._progress_kind) bar_x = inner_x + 10 - bar_room = max(10, width - bar_x - 16) + # Reserve a space plus the label inside the right border so even + # long byte counts never clip against the screen edge. + bar_room = max(10, width - bar_x - len(label) - 2) filled = 0 if total: filled = round(bar_room * min(done, total) / total) @@ -453,7 +456,7 @@ class TaskView: except Exception: pass _text(scr, theme, y, bar_x + bar_room + 1, - _progress_label(self._progress, self._progress_kind), + _fit(label, max(1, (width - 2) - (bar_x + bar_room))), theme["accent"]) y += 1 @@ -967,8 +970,11 @@ class LanesView: row += 1 if lane.progress is not None and not terminal: done, total = lane.progress + label = _progress_label(lane.progress, lane.progress_kind) bar_x = x + 10 - bar_room = max(6, w - 12) + # Reserve a space plus the label inside the right border so the + # percentage is never clipped by (or painted onto) the pane edge. + bar_room = max(6, w - 12 - len(label)) filled = 0 if total: filled = round(bar_room * min(done, total) / total) @@ -979,7 +985,7 @@ class LanesView: except Exception: pass _text(scr, theme, row, bar_x + bar_room + 1, - _progress_label(lane.progress, lane.progress_kind), + _fit(label, max(1, (x + w - 2) - (bar_x + bar_room))), theme["accent"]) row += 1 |
