wormclaude 1.0.92 → 1.0.93
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/dist/cli.js +3 -3
- package/dist/lineeditor.js +60 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { render, Box, Text, useApp, useInput } from 'ink';
|
|
4
|
-
import
|
|
4
|
+
import LineEditor from './lineeditor.js';
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
import { theme, VERSION } from './theme.js';
|
|
7
7
|
import { loadConfig, streamChat, fetchAccount } from './api.js';
|
|
@@ -1068,7 +1068,7 @@ function App() {
|
|
|
1068
1068
|
React.createElement(Text, { color: theme.grey }, t('perm.feedbackPrompt')),
|
|
1069
1069
|
React.createElement(Box, null,
|
|
1070
1070
|
React.createElement(Text, { color: theme.redBright, bold: true }, "\u276F "),
|
|
1071
|
-
React.createElement(
|
|
1071
|
+
React.createElement(LineEditor, { value: permFeedback, onChange: setPermFeedback, onSubmit: (val) => { perm.resolve({ deny: val.trim() }); setPerm(null); setPermMode('select'); }, placeholder: t('perm.feedbackPlaceholder'), isActive: permMode === 'feedback' })),
|
|
1072
1072
|
React.createElement(Text, { color: theme.greyDim }, " Enter g\u00F6nder \u00B7 Esc iptal"))) : (React.createElement(React.Fragment, null,
|
|
1073
1073
|
React.createElement(Text, { color: permSel === 0 ? theme.redBright : theme.grey, bold: permSel === 0 },
|
|
1074
1074
|
permSel === 0 ? '❯ ' : ' ',
|
|
@@ -1102,7 +1102,7 @@ function App() {
|
|
|
1102
1102
|
(React.createElement(Box, { flexDirection: "column" },
|
|
1103
1103
|
React.createElement(Box, { borderStyle: "round", borderColor: busy ? theme.greyDim : theme.red, paddingX: 1 },
|
|
1104
1104
|
React.createElement(Text, { color: theme.redBright, bold: true }, "\u276F "),
|
|
1105
|
-
React.createElement(
|
|
1105
|
+
React.createElement(LineEditor, { value: input, onChange: (val) => { setInput(val); setCmdSel(0); }, onSubmit: onSubmit, placeholder: busy ? 'cevap üretilirken yazabilirsin…' : t('input.placeholder'), isActive: started && !perm && !ask && lang !== null })),
|
|
1106
1106
|
input.startsWith('/') ? (() => {
|
|
1107
1107
|
const filtered = cmdFilter(input);
|
|
1108
1108
|
if (!filtered.length)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Text, useInput } from 'ink';
|
|
3
|
+
// Tam imleç-kontrollü satır editörü (ink-text-input yerine).
|
|
4
|
+
// Destekler: yazma (imleç konumuna ekleme), Backspace/Delete, ← →, Home/End (Ctrl+A/Ctrl+E).
|
|
5
|
+
// ↑↓/PageUp/PageDown/Esc/Tab'a DOKUNMAZ → menü/scroll/dialog handler'larına geçer.
|
|
6
|
+
export default function LineEditor({ value, onChange, onSubmit, placeholder, isActive = true, color }) {
|
|
7
|
+
const [cursor, setCursor] = useState(value.length);
|
|
8
|
+
// value dışarıdan değişirse imleci sınırda tut (örn. submit'te temizlenince).
|
|
9
|
+
useEffect(() => { setCursor((c) => Math.min(c, value.length)); }, [value]);
|
|
10
|
+
useInput((input, key) => {
|
|
11
|
+
if (key.leftArrow) {
|
|
12
|
+
setCursor((c) => Math.max(0, c - 1));
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (key.rightArrow) {
|
|
16
|
+
setCursor((c) => Math.min(value.length, c + 1));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (key.return) {
|
|
20
|
+
onSubmit?.(value);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (key.backspace || key.delete) {
|
|
24
|
+
if (cursor > 0) {
|
|
25
|
+
onChange(value.slice(0, cursor - 1) + value.slice(cursor));
|
|
26
|
+
setCursor(cursor - 1);
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (key.ctrl && input === 'a') {
|
|
31
|
+
setCursor(0);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (key.ctrl && input === 'e') {
|
|
35
|
+
setCursor(value.length);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// Gezinme/özel tuşlar bize ait değil → metne yazma, başka handler'lara bırak.
|
|
39
|
+
if (key.ctrl || key.meta || key.tab || key.escape || key.upArrow || key.downArrow || key.pageUp || key.pageDown)
|
|
40
|
+
return;
|
|
41
|
+
if (input) {
|
|
42
|
+
onChange(value.slice(0, cursor) + input + value.slice(cursor));
|
|
43
|
+
setCursor(cursor + input.length);
|
|
44
|
+
}
|
|
45
|
+
}, { isActive });
|
|
46
|
+
// Placeholder (boş input)
|
|
47
|
+
if (!value) {
|
|
48
|
+
return React.createElement(Text, { color: color, dimColor: true },
|
|
49
|
+
isActive ? React.createElement(Text, { inverse: true }, " ") : ' ',
|
|
50
|
+
placeholder || '');
|
|
51
|
+
}
|
|
52
|
+
// İmleçli metin: imleçteki karakter ters-renkli (blok imleç)
|
|
53
|
+
const before = value.slice(0, cursor);
|
|
54
|
+
const at = value.slice(cursor, cursor + 1) || ' ';
|
|
55
|
+
const after = value.slice(cursor + 1);
|
|
56
|
+
return (React.createElement(Text, { color: color },
|
|
57
|
+
before,
|
|
58
|
+
isActive ? React.createElement(Text, { inverse: true }, at) : at,
|
|
59
|
+
after));
|
|
60
|
+
}
|