silver-tongue 0.6.0 → 0.6.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.
@@ -2043,7 +2043,11 @@ function startApp(opts) {
2043
2043
  }
2044
2044
  const [footerId, count] = mode === "name" ? ["keys-name", 0] : mode === "explore" ? ["keys-explore", menu().length] : mode === "help" ? [lastLine?.meaning ? "keys-help-sentence" : "keys-help", helpWords().length] : replyMode === "pick" ? ["keys-pick", pickOptions2.length] : ["keys-tiles", tiles.length];
2045
2045
  const footer = t(footerId, { keys: keyRange(count) });
2046
- term2.write(renderScreen({ title: t(`place-${s.place}`), hud, log, prompt: prompt(cols - 4), footer, footerRight }, cols, rows));
2046
+ term2.write(
2047
+ renderScreen({ title: t(`place-${s.place}`), hud, log, prompt: prompt(cols - 4), footer, footerRight }, cols, rows),
2048
+ // Typing a name: the cursor sits after the text, where a phone keyboard shows what's being composed.
2049
+ mode === "name" ? { row: rows - 2, col: Math.min(cols - 3, 4 + strWidth(nameInput)) } : void 0
2050
+ );
2047
2051
  }
2048
2052
  function press(key) {
2049
2053
  if (key.name === "ctrl-c") return opts.quit();
@@ -2248,8 +2252,9 @@ function createNodeTerminal(input = process.stdin, output = process.stdout) {
2248
2252
  };
2249
2253
  process.on("exit", restore);
2250
2254
  return {
2251
- write(lines) {
2252
- output.write("\x1B[H\x1B[2J" + lines.map(toAnsi).join("\r\n"));
2255
+ write(lines, cursor) {
2256
+ const place = cursor ? `\x1B[${cursor.row + 1};${cursor.col + 1}H\x1B[?25h` : "\x1B[?25l";
2257
+ output.write("\x1B[H\x1B[2J" + lines.map(toAnsi).join("\r\n") + place);
2253
2258
  },
2254
2259
  onKey(handler) {
2255
2260
  handlers.push(handler);
@@ -2268,7 +2273,7 @@ function createNodeTerminal(input = process.stdin, output = process.stdout) {
2268
2273
  // package.json
2269
2274
  var package_default = {
2270
2275
  name: "silver-tongue",
2271
- version: "0.6.0",
2276
+ version: "0.6.1",
2272
2277
  description: "Learn a language by living in it: a text game for the terminal.",
2273
2278
  type: "module",
2274
2279
  repository: { type: "git", url: "git+https://github.com/jamil314/silver-tongue.git", directory: "packages/tui-node" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "silver-tongue",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Learn a language by living in it: a text game for the terminal.",
5
5
  "type": "module",
6
6
  "repository": { "type": "git", "url": "git+https://github.com/jamil314/silver-tongue.git", "directory": "packages/tui-node" },