@nguyenquangthai/pi-todo 0.2.5 → 0.2.7
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.
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/format.ts +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.7 (2026-07-15)
|
|
4
|
+
|
|
5
|
+
- Progress bar: use ANSI background-color (reverse video) instead of Unicode chars — zero alignment issues.
|
|
6
|
+
- Progress bar colors: filled uses theme `accent`, empty uses theme `muted` for full theme compatibility.
|
|
7
|
+
- Progress format: `[bg-bar] done/total` with single-width spaces.
|
|
8
|
+
- Clean up heading: remove all Unicode block characters, simple and reliable.
|
|
9
|
+
|
|
10
|
+
## 0.2.6 (2026-07-15)
|
|
11
|
+
|
|
12
|
+
- Restore Unicode block chars (`█`/`░`) for progress bar — looks cleaner.
|
|
13
|
+
- Fix alignment: halve bar width (double-width chars) + pad percentage to 3 chars so heading never shifts when % changes.
|
|
14
|
+
- README: update progress bar example to match.
|
|
15
|
+
|
|
3
16
|
## 0.2.5 (2026-07-15)
|
|
4
17
|
|
|
5
18
|
- Fix progress bar: use single-width ASCII (`#`/`·`) instead of double-width Unicode (`█`/`░`) to avoid alignment issues in terminal.
|
package/README.md
CHANGED
|
@@ -58,11 +58,11 @@ Shown above the editor while any **open** todo remains (`pending` / `in_progress
|
|
|
58
58
|
|
|
59
59
|
Hidden when the list is empty or every item is `completed` / `cancelled`.
|
|
60
60
|
|
|
61
|
-
Heading shows open + running counts + progress bar, e.g. `# Todos (3 open, 1 running)
|
|
61
|
+
Heading shows open + running counts + background-color progress bar, e.g. `# Todos (3 open, 1 running) ▓▓▓▓░░░░ 1/4`:
|
|
62
62
|
|
|
63
63
|
- **open** = `pending` + `in_progress`
|
|
64
64
|
- **running** = `in_progress` only (0 or 1 after a valid write)
|
|
65
|
-
- **progress bar** =
|
|
65
|
+
- **progress bar** = ANSI background color via reverse video, using theme `accent` (filled) and `muted` (empty)
|
|
66
66
|
|
|
67
67
|
Items within each status group are sorted by priority (high → medium → low).
|
|
68
68
|
When space is tight, completed/cancelled items collapse into `+N done`.
|
package/package.json
CHANGED
package/src/format.ts
CHANGED
|
@@ -139,7 +139,7 @@ export interface RenderOverlayOptions {
|
|
|
139
139
|
* - open = pending + in_progress
|
|
140
140
|
* - running = in_progress only (0 or 1 after a valid todo_write)
|
|
141
141
|
* Overlay is hidden when open === 0, so "(0 open, 0 running)" is never shown.
|
|
142
|
-
* Includes a
|
|
142
|
+
* Includes a background-color progress bar using theme colors.
|
|
143
143
|
*/
|
|
144
144
|
export function renderOverlayLines(
|
|
145
145
|
todos: readonly TodoItem[],
|
|
@@ -153,17 +153,22 @@ export function renderOverlayLines(
|
|
|
153
153
|
const truncate = (line: string) => truncateToWidth(line, width, "…");
|
|
154
154
|
const open = countOpenTodos(todos);
|
|
155
155
|
const running = countRunningTodos(todos);
|
|
156
|
+
|
|
157
|
+
// Background-color progress bar via reverse video — uses theme accent/dim
|
|
156
158
|
const total = todos.length;
|
|
157
159
|
const done = total - open;
|
|
158
|
-
const
|
|
159
|
-
const barWidth = Math.max(4, Math.min(12, Math.floor(width / 8)));
|
|
160
|
+
const barWidth = Math.max(4, Math.min(10, Math.floor(width / 8)));
|
|
160
161
|
const filled = Math.round((barWidth * done) / total);
|
|
161
|
-
const
|
|
162
|
+
const REV = "\x1b[7m";
|
|
163
|
+
const filledBar = REV + theme.fg("accent", " ".repeat(filled));
|
|
164
|
+
const emptyBar =
|
|
165
|
+
filled < barWidth ? REV + theme.fg("muted", " ".repeat(barWidth - filled)) : "";
|
|
166
|
+
const bar = filledBar + emptyBar + "\x1b[0m";
|
|
162
167
|
|
|
163
168
|
const heading = truncate(
|
|
164
169
|
theme.fg("accent", theme.bold(`# Todos`)) +
|
|
165
170
|
theme.fg("dim", ` (${open} open, ${running} running)`) +
|
|
166
|
-
theme.fg("
|
|
171
|
+
` ${bar}` + theme.fg("dim", ` ${done}/${total}`),
|
|
167
172
|
);
|
|
168
173
|
|
|
169
174
|
// Small gap between heading and first row — budget -1 to account for the blank line
|