From 69babf2af132856cc0221306450c09b368f89e9c Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 13:55:14 +0000 Subject: Fixed bug [1669632fff] case (vi) - <> is atomic --- library/text.tcl | 9 +++++++++ tests/text.test | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index d7c0935..792ee3b 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -1081,9 +1081,18 @@ proc ::tk_textCopy w { proc ::tk_textCut w { if {![catch {set data [$w get sel.first sel.last]}]} { + # make <> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + set oldSeparator [$w cget -autoseparators] + if {$oldSeparator} { + $w edit separator + } clipboard clear -displayof $w clipboard append -displayof $w $data $w delete sel.first sel.last + if {$oldSeparator} { + $w edit separator + } } } diff --git a/tests/text.test b/tests/text.test index a85edfa..2e5e495 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3274,6 +3274,26 @@ test text-25.22 {patch 1669632 (v) - <> is atomic} -setup { } -cleanup { destroy .top.t .top } -result "This A an example text" + test text-25.23 {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 .top.t .top +} -result "This A an example text" test text-26.1 {bug fix - 624372, ControlUtfProc long lines} { destroy .t -- cgit v0.12