mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-07 22:24:06 -05:00
Improved quality for code editing
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user