wispy-cli 2.7.25 → 2.7.26
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/lib/cjk-text-input.mjs +15 -2
- package/package.json +1 -1
package/lib/cjk-text-input.mjs
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* decoded UTF-8 characters — the real fix is handling them correctly.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { useState, useEffect } from "react";
|
|
10
|
-
import { Box, Text, useInput } from "ink";
|
|
9
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
10
|
+
import { Box, Text, useInput, useStdout } from "ink";
|
|
11
11
|
|
|
12
12
|
function CJKTextInput({
|
|
13
13
|
value = "",
|
|
@@ -17,6 +17,19 @@ function CJKTextInput({
|
|
|
17
17
|
focus = true,
|
|
18
18
|
showCursor = true,
|
|
19
19
|
}) {
|
|
20
|
+
const { stdout } = useStdout();
|
|
21
|
+
|
|
22
|
+
// Show real terminal cursor when focused so IME composition popup
|
|
23
|
+
// appears at the correct position (not bottom-right corner)
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (focus && stdout) {
|
|
26
|
+
stdout.write("\x1b[?25h"); // show cursor
|
|
27
|
+
return () => {
|
|
28
|
+
stdout.write("\x1b[?25l"); // hide cursor on unfocus
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}, [focus, stdout]);
|
|
32
|
+
|
|
20
33
|
useInput(
|
|
21
34
|
(input, key) => {
|
|
22
35
|
// Skip keys handled by parent (Tab, Ctrl+C, arrows for view switching)
|
package/package.json
CHANGED