From a5418f9baec04ec33934d02ee9fb8e503fc9b564 Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Mon, 13 Jan 2025 10:38:30 -0800 Subject: [PATCH] Improved quality for code editing --- .../workflow-block/sub-block/components/code.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/w/components/blocks/components/workflow-block/sub-block/components/code.tsx b/app/w/components/blocks/components/workflow-block/sub-block/components/code.tsx index 5ee6082c8..cb08a1c54 100644 --- a/app/w/components/blocks/components/workflow-block/sub-block/components/code.tsx +++ b/app/w/components/blocks/components/workflow-block/sub-block/components/code.tsx @@ -118,6 +118,15 @@ export function Code() { const end = textarea.selectionEnd const currentContent = lines[currentLine].content + // Check if cursor is before a matching closing character + if (start === end && currentContent[start] === closingChar) { + // Just move the cursor past the existing closing character + setTimeout(() => { + textarea.selectionStart = textarea.selectionEnd = start + 1 + }, 0) + return true + } + // Handle selected text - wrap it in brackets/quotes if (start !== end) { const selectedText = currentContent.substring(start, end)