diff options
Diffstat (limited to 'pd/tcl/pdtk_text.tcl')
-rw-r--r-- | pd/tcl/pdtk_text.tcl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pd/tcl/pdtk_text.tcl b/pd/tcl/pdtk_text.tcl index 5818926c..b23ae0b2 100644 --- a/pd/tcl/pdtk_text.tcl +++ b/pd/tcl/pdtk_text.tcl @@ -28,11 +28,14 @@ proc pdtk_text_set {tkcanvas tag text} { # paste into an existing text box by literally "typing" the contents of the # clipboard, i.e. send the contents one character at a time via 'pd key' proc pdtk_pastetext {args} { - catch {set pdtk_pastebuffer [clipboard get]} - for {set i 0} {$i < [string length $pdtk_pastebuffer]} {incr i 1} { - set cha [string index $pdtk_pastebuffer $i] - scan $cha %c keynum - pdsend "pd key 1 $keynum 0" + if { [catch {set pdtk_pastebuffer [clipboard get]}] } { + # no selection... do nothing + } else { + for {set i 0} {$i < [string length $pdtk_pastebuffer]} {incr i 1} { + set cha [string index $pdtk_pastebuffer $i] + scan $cha %c keynum + pdsend "pd key 1 $keynum 0" + } } } |