Skip to content

Commit 5d5bf13

Browse files
committed
Fix paste in the HTML backend.
1 parent 8ba354b commit 5d5bf13

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/fidget/dom2.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,7 @@ proc now*(p: Performance): float
15911591
proc removeAllRanges*(s: Selection)
15921592
proc deleteFromDocument*(s: Selection)
15931593
proc getRangeAt*(s: Selection, index: int): Range
1594+
proc collapse*(s: Selection)
15941595
converter toString*(s: Selection): cstring
15951596
proc `$`*(s: Selection): string = $(s.toString())
15961597

src/fidget/htmlbackend.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ proc startFidget*(draw: proc(), load: proc() = nil, w = 0, h = 0) =
600600
if selection.rangeCount == 0:
601601
return
602602
selection.getRangeAt(0).insertNode(document.createTextNode(paste))
603+
selection.collapse()
603604
ev.preventDefault()
604605
keyboard.input = $document.activeElement.innerText
605606
echo "keyboard.input"

0 commit comments

Comments
 (0)