From e2f4951c81ba0437d402871c1e5d5064e6c578a2 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 3 Oct 2015 19:32:12 +0000 Subject: Fixed bug [1669632fff] case (i) - autoseparator was missing on --- library/text.tcl | 3 +++ tests/text.test | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index 0e43e61..1321334 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -85,6 +85,9 @@ bind Text { } bind Text { %W mark set insert @%x,%y + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text { tk::TextSetCursor %W insert-1displayindices diff --git a/tests/text.test b/tests/text.test index fa00ce3..e170fb4 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3205,6 +3205,20 @@ test text-25.18 {patch 1469210 - inserting after undo} -setup { } -cleanup { destroy .t } -result 1 +test text-25.19 {patch 1669632 (i) - undo after Contron-1} -setup { + destroy .t +} -body { + text .t -undo 1 + .t insert end foo\nbar + .t edit reset + .t insert 2.2 WORLD + event generate .t -x 1 -y 1 + .t insert insert HELLO + .t edit undo + .t get 2.2 2.7 +} -cleanup { + destroy .t +} -result WORLD test text-26.1 {bug fix - 624372, ControlUtfProc long lines} { destroy .t -- cgit v0.12 From 232769312e8b6d7b1fa4bb3674b8afe660b8b59f Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 3 Oct 2015 19:33:41 +0000 Subject: Typo --- tests/text.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/text.test b/tests/text.test index e170fb4..0ea4a6e 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3205,7 +3205,7 @@ test text-25.18 {patch 1469210 - inserting after undo} -setup { } -cleanup { destroy .t } -result 1 -test text-25.19 {patch 1669632 (i) - undo after Contron-1} -setup { +test text-25.19 {patch 1669632 (i) - undo after Control-1} -setup { destroy .t } -body { text .t -undo 1 -- cgit v0.12 From d842640197e344a68b6bb601ec39f74c1d071be0 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 3 Oct 2015 20:00:57 +0000 Subject: Fixed bug [1669632fff] case (iv) - autoseparator was missing on --- library/text.tcl | 3 +++ tests/text.test | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/library/text.tcl b/library/text.tcl index 1321334..396ce1b 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -244,6 +244,9 @@ bind Text { } bind Text { %W tag remove sel 1.0 end + if {[%W cget -autoseparators]} { + %W edit separator + } } bind Text <> { tk_textCut %W diff --git a/tests/text.test b/tests/text.test index 0ea4a6e..661584d 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3205,7 +3205,7 @@ test text-25.18 {patch 1469210 - inserting after undo} -setup { } -cleanup { destroy .t } -result 1 -test text-25.19 {patch 1669632 (i) - undo after Control-1} -setup { +test text-25.19 {patch 1669632 (i) - undo after } -setup { destroy .t } -body { text .t -undo 1 @@ -3219,6 +3219,25 @@ test text-25.19 {patch 1669632 (i) - undo after Control-1} -setup { } -cleanup { destroy .t } -result WORLD +test text-25.20 {patch 1669632 (iv) - undo after } -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 HELLO + .top.t tag add sel 1.10 1.12 + update + focus -force .top.t + event generate .top.t + .top.t insert insert " WORLD " + .top.t edit undo + .top.t get 1.5 1.10 +} -cleanup { + destroy .top.t .top +} -result HELLO test text-26.1 {bug fix - 624372, ControlUtfProc long lines} { destroy .t -- cgit v0.12 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 From 1ece15d3c02b97432d14fd339122e8302cc1a483 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 08:31:40 +0000 Subject: Added forgotten comment for case (i) --- library/text.tcl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index 4a0e2c7..080b133 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -85,6 +85,8 @@ bind Text { } bind Text { %W mark set insert @%x,%y + # An operation that moves the insert mark without making it + # one end of the selection must insert an autoseparator if {[%W cget -autoseparators]} { %W edit separator } -- cgit v0.12 From 520dc94723941cbb70de8f216cb8dce3868bfa59 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 08:32:33 +0000 Subject: Added forgotten comment for case (iv) --- library/text.tcl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index 080b133..f973984 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -246,6 +246,8 @@ bind Text { } bind Text { %W tag remove sel 1.0 end + # An operation that clears the selection must insert an autoseparator, + # because the selection operation may have moved the insert mark if {[%W cget -autoseparators]} { %W edit separator } -- cgit v0.12 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 From d18323e55843fd090168c487519968d92c6ebe37 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 13:52:17 +0000 Subject: Fixed -cleanup section in test text-25.22 --- tests/text.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/text.test b/tests/text.test index 023aedf..a85edfa 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3272,7 +3272,7 @@ test text-25.22 {patch 1669632 (v) - <> is atomic} -setup { event generate .top.t <> .top.t get 1.0 "1.0 lineend" } -cleanup { - destroy .t + destroy .top.t .top } -result "This A an example text" test text-26.1 {bug fix - 624372, ControlUtfProc long lines} { -- cgit v0.12 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 From 39a05589d95ac9864792887ef9c223fa8b09fbaa Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2015 14:07:49 +0000 Subject: Fixed bug [1669632fff] cases (ii) and (iii) - Tolerate a shaky hand using the mouse --- library/text.tcl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/text.tcl b/library/text.tcl index 792ee3b..68ca0f5 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -91,6 +91,10 @@ bind Text { %W edit separator } } +# stop an accidental double click triggering +bind Text { # nothing } +# stop an accidental movement triggering +bind Text { # nothing } bind Text { tk::TextSetCursor %W insert-1displayindices } -- cgit v0.12