From 3259fbc2451dd52b8aec46351254cf38818b3b83 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 11 Mar 2010 09:24:02 +0000 Subject: * generic/tkText.c (DumpLine): [Bug 2968379]: When peers are about, there can be unnamed marks present during a dump. Ignore them as they will just be for the peers' insert and current marks, which aren't very important. --- ChangeLog | 11 +++++++++-- generic/tkText.c | 21 +++++++++++++-------- tests/text.test | 10 ++++++++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6280191..9991e29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ +2010-03-11 Donal K. Fellows + + * generic/tkText.c (DumpLine): [Bug 2968379]: When peers are about, + there can be unnamed marks present during a dump. Ignore them as they + will just be for the peers' insert and current marks, which aren't + very important. + 2010-03-08 Don Porter - * generic/tkPlatDecls.h: Correct broken 2886635 fix. [Bug 2965600] + * generic/tkPlatDecls.h: [Bug 2965600]: Correct broken 2886635 fix. 2010-03-06 Pat Thoyts @@ -12,7 +19,7 @@ * unix/configure.in: Don't use -fvisibility=hidden * unix/tcl.m4: for cygwin. - * win/tkWinTest.c Make tkTestWinProcs const + * win/tkWinTest.c: Make tkTestWinProcs const 2010-03-04 Donal K. Fellows diff --git a/generic/tkText.c b/generic/tkText.c index 650e77b..49cfae0 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.97 2010/02/22 23:38:53 nijtmans Exp $ + * RCS: @(#) $Id: tkText.c,v 1.98 2010/03/11 09:24:07 dkf Exp $ */ #include "default.h" @@ -3115,7 +3115,7 @@ DeleteIndexRange( } else { lineAndByteIndex[resetViewCount] = -1; } - resetViewCount+=2; + resetViewCount += 2; } /* @@ -4580,8 +4580,8 @@ TextDumpCmd( if (lineno == lineend) { break; } - textChanged = DumpLine(interp, textPtr, what, linePtr, 0, 32000000, - lineno, command); + textChanged = DumpLine(interp, textPtr, what, linePtr, 0, + 32000000, lineno, command); if (textChanged) { if (textPtr->flags & DESTROYED) { return TCL_OK; @@ -4716,14 +4716,19 @@ DumpLine( name = "insert"; } else if (segPtr == textPtr->currentMarkPtr) { name = "current"; + } else if (markPtr->hPtr == NULL) { + name = NULL; + lineChanged = 0; } else { name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, markPtr->hPtr); } - TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, - lineno, offset, &index); - lineChanged = DumpSegment(textPtr, interp, "mark", name, - command, &index, what); + if (name != NULL) { + TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, + lineno, offset, &index); + lineChanged = DumpSegment(textPtr, interp, "mark", name, + command, &index, what); + } } else if ((what & TK_DUMP_TAG) && (segPtr->typePtr == &tkTextToggleOnType)) { TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, diff --git a/tests/text.test b/tests/text.test index 5d3060a..cb2c006 100644 --- a/tests/text.test +++ b/tests/text.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: text.test,v 1.55 2009/10/22 21:36:24 dkf Exp $ +# RCS: @(#) $Id: text.test,v 1.56 2010/03/11 09:24:09 dkf Exp $ package require tcltest 2.2 eval tcltest::configure $argv @@ -5875,7 +5875,13 @@ test text-24.26 {TextDumpCmd procedure, unicode characters} -body { } -cleanup { destroy .t } -result "text abc\xb1\xb1\xb1 1.0 mark insert 1.6 mark current 1.6 text {\n} 1.6" - +test text-24.27 {TextDumpCmd procedure, peer present} -body { + text .t + .t peer create .t.t + .t dump -all 1.0 end +} -cleanup { + destroy .t +} -result "mark insert 1.0 mark current 1.0 text {\n} 1.0" test text-25.1 {text widget vs hidden commands} -body { text .t -- cgit v0.12