summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--library/text.tcl17
2 files changed, 17 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index ab60253..fe1e050 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-03-07 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/text.tcl (TextPasteSelection): Renaming of TextPaste to
+ prevent confusion with tk_textPaste. Stopped code from inserting
+ selections twice, which seems to have happened with TIP#26, and
+ reorganized code to reduce amount of stuff protected by catch
+ which is tricky to maintain.
+ (tk_textPaste): Reduce amount of code protected by catch.
+
2002-03-06 Mo DeJong <mdejong@users.sourceforge.net>
* win/tkWinX.c: Define _WIN32_IE as 0x0300
diff --git a/library/text.tcl b/library/text.tcl
index 2dd8d87..bc32264 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -3,7 +3,7 @@
# This file defines the default bindings for Tk text widgets and provides
# procedures that help in implementing the bindings.
#
-# RCS: @(#) $Id: text.tcl,v 1.21 2002/02/15 05:48:08 mdejong Exp $
+# RCS: @(#) $Id: text.tcl,v 1.22 2002/03/07 11:49:49 dkf Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -256,7 +256,7 @@ bind Text <<Clear>> {
bind Text <<PasteSelection>> {
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
|| !$tk::Priv(mouseMoved)} {
- tk::TextPaste %W %x %y
+ tk::TextPasteSelection %W %x %y
}
}
bind Text <Insert> {
@@ -625,7 +625,7 @@ proc ::tk::TextKeyExtend {w index} {
$w tag remove sel $last end
}
-# ::tk::TextPaste --
+# ::tk::TextPasteSelection --
# This procedure sets the insertion cursor to the mouse position,
# inserts the selection, and sets the focus to the window.
#
@@ -633,16 +633,15 @@ proc ::tk::TextKeyExtend {w index} {
# w - The text window.
# x, y - Position of the mouse.
-proc ::tk::TextPaste {w x y} {
+proc ::tk::TextPasteSelection {w x y} {
$w mark set insert [TextClosestGap $w $x $y]
- catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
- catch {
+ if {![catch {::tk::GetSelection $w PRIMARY} sel]} {
set oldSeparator [$w cget -autoseparators]
if {$oldSeparator} {
$w configure -autoseparators 0
$w edit separator
}
- $w insert insert [::tk::GetSelection $w PRIMARY]
+ $w insert insert $sel
if {$oldSeparator} {
$w edit separator
$w configure -autoseparators 1
@@ -997,7 +996,7 @@ proc ::tk_textCut w {
proc ::tk_textPaste w {
global tcl_platform
- catch {
+ if {![catch {::tk::GetSelection $w CLIPBOARD} sel]} {
set oldSeparator [$w cget -autoseparators]
if { $oldSeparator } {
$w configure -autoseparators 0
@@ -1006,7 +1005,7 @@ proc ::tk_textPaste w {
if {[string compare $tcl_platform(platform) "unix"]} {
catch { $w delete sel.first sel.last }
}
- $w insert insert [::tk::GetSelection $w CLIPBOARD]
+ $w insert insert $sel
if { $oldSeparator } {
$w edit separator
$w configure -autoseparators 1