Fixed code editing bug and shortened agent input

This commit is contained in:
Emir Karabeg
2025-01-15 14:28:58 -08:00
parent d8ac75ca50
commit fac078dea1
2 changed files with 18 additions and 1 deletions
@@ -124,6 +124,23 @@ export function Code() {
const handleAutoClose = useCallback(
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
// If we're typing a closing character (not an opening one)
if (Object.values(MATCHING_PAIRS).includes(e.key)) {
const textarea = e.currentTarget
const start = textarea.selectionStart
const currentContent = lines[currentLine].content
// If cursor is before the same closing character, just move cursor
if (currentContent[start] === e.key) {
e.preventDefault()
setTimeout(() => {
textarea.selectionStart = textarea.selectionEnd = start + 1
}, 0)
return true
}
}
// Handle opening characters
const closingChar = MATCHING_PAIRS[e.key]
if (!closingChar) return false
+1 -1
View File
@@ -27,7 +27,7 @@ export const AgentBlock: BlockConfig = {
},
{
title: 'Context',
type: 'long-input',
type: 'short-input',
layout: 'full',
},
{