From 03be57bf29ab5c74d5c517f01b29f3bfbb706f7d Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 25 Oct 2009 13:47:16 +0000 Subject: Fix [Bug 1854913] by improving the class bindings. --- ChangeLog | 6 ++++++ library/text.tcl | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41a0ad9..7f960e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-25 Donal K. Fellows + + * library/text.tcl: [Bug 1854913]: Stop actions from ever + deleting backwards, even when the insertion cursor is "at the end" of + the text widget. + 2009-10-24 Donal K. Fellows * library/button.tcl, unix/tkUnixButton.c (TkpDisplayButton): diff --git a/library/text.tcl b/library/text.tcl index e4bd77d..509d425 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.43 2008/12/28 23:43:14 dkf Exp $ +# RCS: @(#) $Id: text.tcl,v 1.44 2009/10/25 13:47:16 dkf Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -211,15 +211,19 @@ bind Text { if {[%W tag nextrange sel 1.0 end] ne ""} { %W delete sel.first sel.last } else { - %W delete insert + if {[%W compare end != insert+1c]} { + %W delete insert + } %W see insert } } bind Text { if {[%W tag nextrange sel 1.0 end] ne ""} { %W delete sel.first sel.last - } elseif {[%W compare insert != 1.0]} { - %W delete insert-1c + } else { + if {[%W compare insert != 1.0]} { + %W delete insert-1c + } %W see insert } } @@ -296,7 +300,7 @@ bind Text { } } bind Text { - if {!$tk_strictMotif} { + if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert } } @@ -311,7 +315,7 @@ bind Text { } } bind Text { - if {!$tk_strictMotif} { + if {!$tk_strictMotif && [%W compare end != insert+1c]} { if {[%W compare insert == {insert lineend}]} { %W delete insert } else { @@ -355,7 +359,7 @@ bind Text { } } bind Text { - if {!$tk_strictMotif} { + if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert [tk::TextNextWord %W insert] } } @@ -759,7 +763,6 @@ proc ::tk::TextAutoScan {w} { # pos - The desired new position for the cursor in the window. proc ::tk::TextSetCursor {w pos} { - if {[$w compare $pos == end]} { set pos {end - 1 chars} } @@ -782,7 +785,6 @@ proc ::tk::TextSetCursor {w pos} { # actually been moved to this position yet). proc ::tk::TextKeySelect {w new} { - set anchorname [tk::TextAnchor $w] if {[$w tag nextrange sel 1.0 end] eq ""} { if {[$w compare $new < insert]} { -- cgit v0.12