diff -Naur tk-fa928fb2/library/text.tcl patched/library/text.tcl
--- tk-fa928fb2/library/text.tcl	2018-01-07 16:59:26.000000000 +0000
+++ patched/library/text.tcl	2018-01-13 15:35:51.092359459 +0000
@@ -383,7 +383,7 @@
     }
 }
 bind Text <Meta-d> {
-    if {!$tk_strictMotif && [%W compare end != insert+1i]} {
+    if {[%W cget -state] eq "normal" && !$tk_strictMotif && [%W compare end != insert+1i]} {
 	%W delete insert [tk::TextNextWord %W insert]
     }
 }
@@ -1119,7 +1119,7 @@
     if {![catch {set data [$w get sel.first sel.last]}]} {
 	# make <<Cut>> an atomic operation on the Undo stack,
 	# i.e. separate it from other delete operations on either side
-	if {[$w cget -autoseparators]} {
+	if {([$w cget -state] eq "normal") && [$w cget -autoseparators]} {
 	    $w edit separator
 	}
 	clipboard clear -displayof $w
@@ -1127,7 +1127,7 @@
 	if {[$w cget -state] eq "normal"} {
 	    ::tk::TextDelete $w sel.first sel.last
 	}
-	if {[$w cget -autoseparators]} {
+	if {([$w cget -state] eq "normal") && [$w cget -autoseparators]} {
 	    $w edit separator
 	}
     }
@@ -1200,10 +1200,10 @@
 # op -		Function to use to find next position.
 
 proc ::tk::TextPrevPos {w start op} {
-    set text ""
     set succ ""
     set cur $start
     while {[$w compare $cur > 1.0]} {
+	set text ""
 	append text [$w get -displaychars "$cur linestart - 1i" $cur] $succ
 	set pos [$op $text end]
 	if {$pos >= 0} {
@@ -1283,7 +1283,6 @@
 #
 # Arguments:
 # w -		The text window.
-# x, y - 	Position of the mouse.
 # selection	atom name of the selection
 
 proc ::tk::TextInsertSelection {w selection} {
@@ -1303,6 +1302,14 @@
 	$w edit separator
 	$w configure -autoseparators 1
     }
+    # The PRIMARY selection has changed but the widget does
+    # not generate this event.
+    if {    ($selection eq "PRIMARY")
+	 && [$w cget -exportselection]
+	 && [TextCursorInSelection $w]
+    } {
+	event generate $w <<Selection>>
+    }
 }
 
 # ::tk_textInsert --
