From 2a9d9b8904088e9b63f5c507d775720ce88aa881 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 08:29:59 +0000 Subject: Fixed bug [1669632fff] case (vii) - <> shall not remove separators --- library/text.tcl | 9 +++++++++ tests/text.test | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index 396ce1b..4a0e2c7 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -346,7 +346,16 @@ bind Text { } bind Text <> { + # An Undo operation may remove the separator at the top of the Undo stack. + # Then the item at the top of the stack gets merged with the subsequent changes. + # Place separators before and after Undo to prevent this. + if {[%W cget -autoseparators]} { + %W edit separator + } catch { %W edit undo } + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text <> { diff --git a/tests/text.test b/tests/text.test index 661584d..4eeb8e4 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3238,6 +3238,22 @@ test text-25.20 {patch 1669632 (iv) - undo after } -setup { } -cleanup { destroy .top.t .top } -result HELLO +test text-25.21 {patch 1669632 (vii) - <> shall not remove separators} -setup { + destroy .t +} -body { + text .t -undo 1 + .t insert end "This is an example text" + .t edit reset + .t insert 1.5 "WORLD " + event generate .t -x 1 -y 1 + .t insert insert HELLO + event generate .t <> + .t insert insert E + event generate .t <> + .t get 1.0 "1.0 lineend" +} -cleanup { + destroy .t +} -result "This WORLD is an example text" test text-26.1 {bug fix - 624372, ControlUtfProc long lines} { destroy .t -- cgit v0.12