tledger 0.1.3 → 0.2.0

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.
@@ -12,6 +12,7 @@ function actionFor(input) {
12
12
  if (value.includes("\u001b[A") || value === "k") return "up";
13
13
  if (value.includes("\u001b[B") || value === "j") return "down";
14
14
  if (value === "q" || value === "Q" || value === "\u0003" || value === "\u001b") return "quit";
15
+ if (value === "\r" || value === "\n") return "inspect";
15
16
  return null;
16
17
  }
17
18
 
@@ -28,23 +29,19 @@ export function startInteractive(view) {
28
29
  let closed = false;
29
30
 
30
31
  const draw = () => {
31
- try {
32
- const width = Math.max(40, options.width || stdout.columns || 120);
33
- const height = Math.max(12, stdout.rows || 32);
34
- const screen = renderFullscreen({
35
- options: { ...options, forceColor: true, selectedIndex },
36
- snapshot,
37
- bounds,
38
- events,
39
- rows,
40
- allRows,
41
- width,
42
- height,
43
- });
44
- stdout.write(`${SCREEN_BASE}${CLEAR_SCREEN}${screen}`);
45
- } catch (error) {
46
- finish(error);
47
- }
32
+ const width = Math.max(40, stdout.columns || 120);
33
+ const height = Math.max(12, stdout.rows || 32);
34
+ const screen = renderFullscreen({
35
+ options: { ...options, forceColor: true, selectedIndex },
36
+ snapshot,
37
+ bounds,
38
+ events,
39
+ rows,
40
+ allRows,
41
+ width,
42
+ height,
43
+ });
44
+ stdout.write(`${SCREEN_BASE}${CLEAR_SCREEN}${screen}`);
48
45
  };
49
46
 
50
47
  const finish = (error = null) => {
@@ -53,8 +50,6 @@ export function startInteractive(view) {
53
50
  stdin.off("data", onData);
54
51
  stdout.off("resize", draw);
55
52
  process.off("SIGINT", onSignal);
56
- process.off("SIGTERM", onSignal);
57
- process.off("SIGHUP", onSignal);
58
53
  if (stdin.isTTY) stdin.setRawMode(false);
59
54
  stdin.pause();
60
55
  stdout.write(`${RESET}${SHOW_CURSOR}${EXIT_ALT_SCREEN}`);
@@ -79,6 +74,7 @@ export function startInteractive(view) {
79
74
  draw();
80
75
  return;
81
76
  }
77
+ if (action === "inspect") draw();
82
78
  };
83
79
 
84
80
  stdin.setRawMode(true);
@@ -87,8 +83,6 @@ export function startInteractive(view) {
87
83
  stdin.on("data", onData);
88
84
  stdout.on("resize", draw);
89
85
  process.once("SIGINT", onSignal);
90
- process.once("SIGTERM", onSignal);
91
- process.once("SIGHUP", onSignal);
92
86
  stdout.write(`${ENTER_ALT_SCREEN}${SCREEN_BASE}${HIDE_CURSOR}${CLEAR_SCREEN}`);
93
87
  draw();
94
88
  });