aboutsummaryrefslogtreecommitdiff
path: root/pd/tcl/pdtk_text.tcl
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:41:04 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:41:04 +0000
commite1fc51c3a1d944193032d8bb1d95741d090b6d3b (patch)
tree7a2121c73a5acb69a080e73ad8e3b50cc3670616 /pd/tcl/pdtk_text.tcl
parent21c068f1916330e90f814bed461fe0821d1665ec (diff)
checked in pd-0.43-1test4.src.tar.gz
svn path=/trunk/; revision=15558
Diffstat (limited to 'pd/tcl/pdtk_text.tcl')
-rw-r--r--pd/tcl/pdtk_text.tcl13
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"
+ }
}
}