From 605af9dd39143e83428df6fd8c1f06955da799fa Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 09:04:42 +0000 Subject: Fixed bug [1669632fff] case (v) - <> is atomic --- library/text.tcl | 8 ++++++++ tests/text.test | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index f973984..d7c0935 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -262,7 +262,15 @@ bind Text <> { tk_textPaste %W } bind Text <> { + # Make <> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + if {[%W cget -autoseparators]} { + %W edit separator + } catch {%W delete sel.first sel.last} + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text <> { if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)] diff --git a/tests/text.test b/tests/text.test index 4eeb8e4..023aedf 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3254,6 +3254,26 @@ test text-25.21 {patch 1669632 (vii) - <> shall not remove separators} -se } -cleanup { destroy .t } -result "This WORLD is an example text" +test text-25.22 {patch 1669632 (v) - <> is atomic} -setup { + destroy .t +} -body { + toplevel .top + pack [text .top.t -undo 1] + .top.t insert end "This is an example text" + .top.t edit reset + .top.t mark set insert 1.5 + .top.t insert 1.5 "A" + update + focus -force .top.t + event generate .top.t + event generate .top.t + event generate .top.t <> + event generate .top.t + event generate .top.t <> + .top.t get 1.0 "1.0 lineend" +} -cleanup { + destroy .t +} -result "This A an example text" test text-26.1 {bug fix - 624372, ControlUtfProc long lines} { destroy .t -- cgit v0.12