codeep 1.0.41 → 1.0.42
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/components/Input.js +28 -6
- package/package.json +1 -1
package/dist/components/Input.js
CHANGED
|
@@ -33,10 +33,11 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
|
|
|
33
33
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
34
34
|
const [pasteInfo, setPasteInfo] = useState(null);
|
|
35
35
|
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
36
|
-
// Paste detection using timing - chars arriving
|
|
36
|
+
// Paste detection using timing - chars arriving fast = paste
|
|
37
37
|
const inputBuffer = useRef('');
|
|
38
38
|
const lastInputTime = useRef(0);
|
|
39
39
|
const pasteTimeout = useRef(null);
|
|
40
|
+
const charTimings = useRef([]);
|
|
40
41
|
// Clear input when clearTrigger changes
|
|
41
42
|
useEffect(() => {
|
|
42
43
|
if (clearTrigger > 0) {
|
|
@@ -255,17 +256,38 @@ export const ChatInput = ({ onSubmit, disabled, history = [], clearTrigger = 0 }
|
|
|
255
256
|
const now = Date.now();
|
|
256
257
|
const timeSinceLastInput = now - lastInputTime.current;
|
|
257
258
|
lastInputTime.current = now;
|
|
258
|
-
//
|
|
259
|
-
|
|
259
|
+
// Track timing for paste detection
|
|
260
|
+
// Paste typically sends many chars with < 10ms between them
|
|
261
|
+
const isPasteLikeTiming = timeSinceLastInput < 15;
|
|
262
|
+
if (isPasteLikeTiming || inputBuffer.current.length > 0) {
|
|
263
|
+
// Add to buffer
|
|
260
264
|
inputBuffer.current += input;
|
|
265
|
+
charTimings.current.push(timeSinceLastInput);
|
|
261
266
|
// Clear existing timeout
|
|
262
267
|
if (pasteTimeout.current) {
|
|
263
268
|
clearTimeout(pasteTimeout.current);
|
|
264
269
|
}
|
|
265
|
-
// Set timeout to process buffer
|
|
270
|
+
// Set timeout to process buffer - wait a bit longer to collect all paste chars
|
|
266
271
|
pasteTimeout.current = setTimeout(() => {
|
|
267
|
-
|
|
268
|
-
|
|
272
|
+
const buffer = inputBuffer.current;
|
|
273
|
+
const timings = charTimings.current;
|
|
274
|
+
inputBuffer.current = '';
|
|
275
|
+
charTimings.current = [];
|
|
276
|
+
if (!buffer)
|
|
277
|
+
return;
|
|
278
|
+
// Calculate average timing - if most chars came fast, it's a paste
|
|
279
|
+
const fastChars = timings.filter(t => t < 15).length;
|
|
280
|
+
const isPaste = buffer.length > 5 && (fastChars / timings.length) > 0.5;
|
|
281
|
+
if (isPaste && (buffer.length > 30 || buffer.includes('\n'))) {
|
|
282
|
+
// Treat as paste
|
|
283
|
+
handlePastedText(buffer, true);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
// Just fast typing, add normally
|
|
287
|
+
setValue(prev => prev + buffer);
|
|
288
|
+
setCursorPos(prev => prev + buffer.length);
|
|
289
|
+
}
|
|
290
|
+
}, 50); // Wait 50ms to collect all paste chars
|
|
269
291
|
return; // Don't add to value yet
|
|
270
292
|
}
|
|
271
293
|
// Normal single character input (slow typing)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
4
4
|
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|