dikt 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/cli.mjs +11 -4
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -39,7 +39,7 @@ const moveTo = (row, col = 1) => `${ESC}${row};${col}H`;
39
39
 
40
40
  // ── Constants ─────────────────────────────────────────────────────────────────
41
41
 
42
- const VERSION = '1.1.0';
42
+ const VERSION = '1.1.2';
43
43
  const CONFIG_BASE = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
44
44
  const CONFIG_DIR = path.join(CONFIG_BASE, 'dikt');
45
45
  const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
@@ -619,7 +619,8 @@ function startRecording() {
619
619
  stdio: ['ignore', 'ignore', 'pipe'],
620
620
  });
621
621
 
622
- state.recProc.stderr.on('data', () => {}); // suppress sox warnings
622
+ let recStderr = '';
623
+ state.recProc.stderr.on('data', (d) => { recStderr += d; });
623
624
 
624
625
  state.recProc.on('error', (err) => {
625
626
  state.mode = 'error';
@@ -629,8 +630,14 @@ function startRecording() {
629
630
  renderAll();
630
631
  });
631
632
 
632
- state.recProc.on('close', () => {
633
+ state.recProc.on('close', (code) => {
633
634
  state.recProc = null;
635
+ if (code && state.mode === 'recording') {
636
+ clearInterval(state.timerInterval);
637
+ state.mode = 'error';
638
+ state.error = recStderr.trim().split('\n').pop() || `rec exited with code ${code}`;
639
+ renderAll();
640
+ }
634
641
  });
635
642
 
636
643
  state.timerInterval = setInterval(() => {
@@ -865,7 +872,7 @@ async function runSetup() {
865
872
  process.stdin.resume();
866
873
  process.stdin.setRawMode(true);
867
874
  process.stdin.on('keypress', handleKey);
868
- process.stdout.write(ALT_SCREEN_ON + HIDE_CURSOR + CLEAR_SCREEN);
875
+ process.stdout.write(CLEAR_SCREEN + ALT_SCREEN_ON + HIDE_CURSOR + CLEAR_SCREEN);
869
876
  renderAll();
870
877
  }
871
878
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dikt",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Voice dictation for the terminal.",
5
5
  "type": "module",
6
6
  "bin": {