pomotty 1.2.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/cli.js +7 -3
  2. package/package.json +5 -2
package/dist/cli.js CHANGED
@@ -656,7 +656,7 @@ const FIRST_CHOICE_INDEX = 0;
656
656
  const KEYPRESS_EVENT_KEY_INDEX = 1;
657
657
  const MOVE_KEY_NAMES = /* @__PURE__ */ new Set(["down", "up"]);
658
658
  const NEXT_INDEX_OFFSET = 1;
659
- const REDRAW_SEQUENCE = `\r\u001B[${CHOICES.length}A\u001B[J`;
659
+ const CLEAR_SELECTION_SEQUENCE = `\r\u001B[${CHOICES.length}A\u001B[J`;
660
660
  const STDIN_CLOSE_EVENTS = ["end", "close"];
661
661
  const SELECTION_QUESTION = "Start working? (Use ↑/↓ to select, Enter to confirm)";
662
662
  const keyFrom = (value) => {
@@ -717,12 +717,16 @@ const handleKey = (key, selectedIndex, terminal) => {
717
717
  }
718
718
  if (MOVE_KEY_NAMES.has(key.name)) {
719
719
  const newSelectedIndex = nextChoiceIndex(selectedIndex);
720
- terminal.write(`${REDRAW_SEQUENCE}${renderSelection(newSelectedIndex)}`);
720
+ terminal.write(`${CLEAR_SELECTION_SEQUENCE}${renderSelection(newSelectedIndex)}`);
721
721
  return newSelectedIndex;
722
722
  }
723
723
  if (ENTER_KEY_NAMES.has(key.name)) {
724
+ if (CHOICES[selectedIndex] === "OK") {
725
+ terminal.write(CLEAR_SELECTION_SEQUENCE);
726
+ return true;
727
+ }
724
728
  terminal.write("\n");
725
- return CHOICES[selectedIndex] === "OK";
729
+ return false;
726
730
  }
727
731
  return selectedIndex;
728
732
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pomotty",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "An interactive terminal Pomodoro timer with configurable work and break sessions and sound notifications.",
5
5
  "keywords": [
6
6
  "cli",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "22.20.1",
38
+ "@vitest/coverage-v8": "^4.1.10",
38
39
  "oxfmt": "^0.61.0",
39
40
  "oxlint": "^1.76.0",
40
41
  "tsdown": "^0.23.0",
@@ -59,6 +60,8 @@
59
60
  "lint:fix": "oxlint . --fix --deny-warnings --report-unused-disable-directives-severity=error",
60
61
  "format": "oxfmt --write",
61
62
  "format:check": "oxfmt --check",
62
- "test": "vitest run --dir src"
63
+ "test": "vitest run --dir src",
64
+ "test:coverage": "vitest run --dir src --coverage",
65
+ "test:watch": "vitest --dir src"
63
66
  }
64
67
  }