bdtui 0.7.0 → 0.7.1

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 CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.7.1] - 2026-06-21
8
+
9
+ ### Fixed
10
+
11
+ - The **Keybindings** (`?`) help can now be dismissed after a mouse click moves focus to the Beads list or Detail pane. Its close keys were bound to the help box itself, so once a click stole focus the modal became unclosable (every global key is suppressed while a modal is open). `q`/`Esc`/`h` are now bound at the screen level and dismiss it regardless of which pane holds focus.
12
+ - Reopening the Keybindings help with `?` works again. `?` is now a single open/close toggle, fixing a re-entrancy where the freshly-registered `?` close handler fired on the very keypress that opened the modal and slammed it shut.
13
+ - The boot status bar no longer shows the `? help` hint twice. `setStatus` already appends it, so the redundant hint baked into the "Ready" message was removed.
14
+
7
15
  ## [0.7.0] - 2026-06-21
8
16
 
9
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdtui",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Terminal UI for the bd beads issue tracker",
5
5
  "type": "module",
6
6
  "bin": {
package/src/app.js CHANGED
@@ -282,9 +282,19 @@ export async function run(cwd) {
282
282
  setStatus(defaultStatus());
283
283
  });
284
284
 
285
- key(['?'], () => {
285
+ // '?' toggles the help modal. Registered directly (NOT through key(), which
286
+ // swallows every global while a modal is open) so the same key that opens the
287
+ // help can also close it. Driving open AND close from this one handler — kept
288
+ // out of showHelp's own close keys — avoids re-entrancy: a separate '?' close
289
+ // binding would fire on the very keypress that registered it and slam the
290
+ // modal shut again. closeHelp is non-null exactly while the help is open.
291
+ let closeHelp = null;
292
+ screen.key(['?'], () => {
293
+ if (closeHelp) { closeHelp(); return; }
294
+ if (modalOpen) return; // another modal (a picker) owns the screen
286
295
  modalOpen = true;
287
- showHelp(screen, () => {
296
+ closeHelp = showHelp(screen, () => {
297
+ closeHelp = null;
288
298
  modalOpen = false;
289
299
  list.focus();
290
300
  screen.render();
@@ -564,5 +574,7 @@ export async function run(cwd) {
564
574
  setStatus(err.message, true);
565
575
  }
566
576
  render();
567
- setStatus('Ready | ? help');
577
+ // setStatus already appends "? help · q quit"; defaultStatus() yields "Ready"
578
+ // (or the active-filter summary) without duplicating the help hint.
579
+ setStatus(defaultStatus());
568
580
  }
package/src/keys.js CHANGED
@@ -65,11 +65,34 @@ export function showHelp(screen, onClose) {
65
65
  box.focus();
66
66
  screen.render();
67
67
 
68
+ // '?' is deliberately NOT a close key here — the caller (app.js) drives it as
69
+ // an open/close toggle. Binding '?' as a close key would re-enter on the very
70
+ // keypress that opens the modal: the toggle adds this listener mid-dispatch
71
+ // and blessed's emitter would then fire it in the same 'key ?' pass, slamming
72
+ // the help shut the instant it opened. q/Esc/h are safe — they never open the
73
+ // help, so they can only ever close it.
74
+ const CLOSE_KEYS = ['q', 'escape', 'h'];
75
+ let closed = false;
68
76
  const close = () => {
77
+ if (closed) return;
78
+ closed = true;
79
+ screen.unkey(CLOSE_KEYS, close);
69
80
  box.destroy();
70
81
  screen.render();
71
82
  onClose?.();
72
83
  };
73
84
 
74
- box.key(['?', 'q', 'escape', 'h'], close);
85
+ // Bind the close keys on the screen, not the box. A box-level binding only
86
+ // fires while the box holds keyboard focus, but the Beads list and Detail
87
+ // pane are both mouse:true — a click on either steals focus from the help
88
+ // box. app.js suppresses every global key while a modal is open, so a
89
+ // focus-stealing click would otherwise leave the help permanently stuck
90
+ // open (its own close keys dead, every global key inert). Screen-level keys
91
+ // fire regardless of which pane holds focus, so q/Esc/h always dismiss it.
92
+ // unkey() on close keeps the binding from leaking across repeated opens.
93
+ screen.key(CLOSE_KEYS, close);
94
+
95
+ // Returned so the caller's '?' toggle can dismiss the help regardless of
96
+ // which pane currently holds focus.
97
+ return close;
75
98
  }