MCPcopy
hub / github.com/antonmedv/codejar / handleSelfClosingCharacters

Function handleSelfClosingCharacters

codejar.ts:365–378  ·  view source on GitHub ↗
(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

363 }
364
365 function handleSelfClosingCharacters(event: KeyboardEvent) {
366 const open = options.autoclose.open;
367 const close = options.autoclose.close;
368 if (open.includes(event.key)) {
369 preventDefault(event)
370 const pos = save()
371 const wrapText = pos.start == pos.end ? '' : getSelection().toString()
372 const text = event.key + wrapText + (close[open.indexOf(event.key)] ?? "")
373 insert(text)
374 pos.start++
375 pos.end++
376 restore(pos)
377 }
378 }
379
380 function handleTabCharacters(event: KeyboardEvent) {
381 if (event.key === 'Tab') {

Callers 1

CodeJarFunction · 0.85

Calls 5

preventDefaultFunction · 0.85
saveFunction · 0.85
getSelectionFunction · 0.85
insertFunction · 0.85
restoreFunction · 0.85

Tested by

no test coverage detected