From e1fc51c3a1d944193032d8bb1d95741d090b6d3b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 9 Oct 2011 16:41:04 +0000 Subject: checked in pd-0.43-1test4.src.tar.gz svn path=/trunk/; revision=15558 --- pd/tcl/pdtk_text.tcl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pd/tcl/pdtk_text.tcl') 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" + } } } -- cgit v1.2.1