Improved quality for code editing

This commit is contained in:
Emir Karabeg
2025-01-13 10:38:30 -08:00
parent 51d4739448
commit a5418f9bae

View File

@@ -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)