summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-12-12 14:13:08 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-12-12 14:13:08 (GMT)
commit4ab5dcf151a4b668fb170ae82adea3af495130d2 (patch)
tree029fae5530aeaec373a4eb28b686ff94a713187b
parent81a1693b1c416801e50d052f141b38c68887ea72 (diff)
downloadtk-4ab5dcf151a4b668fb170ae82adea3af495130d2.zip
tk-4ab5dcf151a4b668fb170ae82adea3af495130d2.tar.gz
tk-4ab5dcf151a4b668fb170ae82adea3af495130d2.tar.bz2
merge updates from HEAD
-rw-r--r--ChangeLog32
-rw-r--r--doc/event.n7
-rw-r--r--generic/tkText.c30
-rw-r--r--generic/ttk/ttkTheme.c18
-rw-r--r--tests/text.test11
5 files changed, 70 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index b288292..dbcba4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,19 +1,37 @@
+2007-12-11 Joe English <jenglish@users.sourceforge.net>
+ * generic/ttk/ttkTheme.c(StyleElementOptionsCmd):
+ Use Ttk_GetElement() to find element instead of direct
+ hash table access.
+
+2007-12-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkText.c (TextReplaceCmd): Added code to rebuild the from
+ index after the deletion phase so that the linePtr field is valid for
+ the insertion phase. [Bug 1602537]
+
+2007-12-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/event.n: Clarify the fact that [event info] only returns the
+ names of virtual events that are bound to physical event sequences.
+ This follows on from comments on comp.lang.tcl.
+ http://groups.google.com/group/comp.lang.tcl/msg/935d2d226ae8a770
+
2007-12-10 Joe English <jenglish@users.sourceforge.net>
* doc/AddOption.3, doc/CrtImgType.3, doc/CrtPhImgFmt.3,
- doc/InternAtom.3, doc/TextLayout.3, doc/chooseColor.n,
- doc/chooseDirectory.n, doc/loadTk.n, doc/palette.n,
- doc/ttk_combobox.n: Various markup fixes (mostly: missing
- quotes on .SH arguments, extraneous .PPs)
+ * doc/InternAtom.3, doc/TextLayout.3, doc/chooseColor.n,
+ * doc/chooseDirectory.n, doc/loadTk.n, doc/palette.n,
+ * doc/ttk_combobox.n: Various markup fixes (mostly: missing quotes on
+ .SH arguments, extraneous .PPs)
- * doc/ttk_entry.n, doc/ttk_scrollbar.n, doc/ttk_treeview.n:
- Remove extra .BEs that got added by mistake somewhere.
+ * doc/ttk_entry.n, doc/ttk_scrollbar.n, doc/ttk_treeview.n: Remove
+ extra .BEs that got added by mistake somewhere.
2007-12-10 Daniel Steffen <das@users.sourceforge.net>
* generic/tk.decls: use new genstubs 'export' command to
* generic/tkInt.decls: mark exported symbols not in stubs
- table [FR 1716117]; cleanup formatting.
+ table [FR 1716117]; cleanup formatting
* generic/tkIntDecls.h: regen with new genStubs.tcl.
* generic/tkIntPlatDecls.h: [Tcl Bug 1834288]
diff --git a/doc/event.n b/doc/event.n
index 2c729e5..85fcdb1 100644
--- a/doc/event.n
+++ b/doc/event.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: event.n,v 1.12.2.2 2007/11/02 14:51:39 dgp Exp $
+'\" RCS: @(#) $Id: event.n,v 1.12.2.3 2007/12/12 14:13:09 dgp Exp $
'\"
.so man.macros
.TH event n 8.3 Tk "Tk Built-In Commands"
@@ -76,6 +76,11 @@ If \fB<<\fIvirtual\fB>>\fR is specified then the return value is
a list whose elements are the physical event sequences currently
defined for the given virtual event; if the virtual event is
not defined then an empty string is returned.
+.RS
+.PP
+Note that virtual events that that are not bound to physical event
+sequences are \fInot\fR returned by \fBevent info\fR.
+.RE
.SH "EVENT FIELDS"
.PP
The following options are supported for the \fBevent generate\fR
diff --git a/generic/tkText.c b/generic/tkText.c
index 5ab82f2..1783b63 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.75.2.1 2007/09/07 01:25:36 dgp Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.75.2.2 2007/12/12 14:13:09 dgp Exp $
*/
#include "default.h"
@@ -1726,7 +1726,8 @@ TextReplaceCmd(
*/
int origAutoSep = textPtr->sharedTextPtr->autoSeparators;
- int result;
+ int result, lineNumber;
+ TkTextIndex indexTmp;
if (textPtr->sharedTextPtr->undo) {
textPtr->sharedTextPtr->autoSeparators = 0;
@@ -1736,9 +1737,18 @@ TextReplaceCmd(
}
}
+ /*
+ * Must save and restore line in indexFromPtr based on line number; can't
+ * keep the line itself as that might be eliminated/invalidated when
+ * deleting the range. [Bug 1602537]
+ */
+
+ indexTmp = *indexFromPtr;
+ lineNumber = TkBTreeLinesTo(textPtr, indexFromPtr->linePtr);
DeleteIndexRange(NULL, textPtr, indexFromPtr, indexToPtr, viewUpdate);
+ indexTmp.linePtr = TkBTreeFindLine(indexTmp.tree, textPtr, lineNumber);
result = TextInsertCmd(NULL, textPtr, interp, objc-4, objv+4,
- indexFromPtr, viewUpdate);
+ &indexTmp, viewUpdate);
if (textPtr->sharedTextPtr->undo) {
textPtr->sharedTextPtr->lastEditMode = TK_TEXT_EDIT_REPLACE;
@@ -3101,7 +3111,7 @@ DeleteIndexRange(
Tcl_Obj *get;
if (sharedTextPtr->autoSeparators
- && (sharedTextPtr->lastEditMode != TK_TEXT_EDIT_DELETE)) {
+ && (sharedTextPtr->lastEditMode != TK_TEXT_EDIT_DELETE)) {
TkUndoInsertUndoSeparator(sharedTextPtr->undoStack);
}
@@ -3123,17 +3133,18 @@ DeleteIndexRange(
if (line != -1) {
int byteIndex = lineAndByteIndex[resetViewCount+1];
+ TkTextIndex indexTmp;
if (tPtr == textPtr) {
if (viewUpdate) {
TkTextMakeByteIndex(sharedTextPtr->tree, textPtr, line,
- byteIndex, &index1);
- TkTextSetYView(tPtr, &index1, 0);
+ byteIndex, &indexTmp);
+ TkTextSetYView(tPtr, &indexTmp, 0);
}
} else {
- TkTextMakeByteIndex(sharedTextPtr->tree, NULL, line, byteIndex,
- &index1);
- TkTextSetYView(tPtr, &index1, 0);
+ TkTextMakeByteIndex(sharedTextPtr->tree, NULL, line,
+ byteIndex, &indexTmp);
+ TkTextSetYView(tPtr, &indexTmp, 0);
}
}
resetViewCount += 2;
@@ -3143,7 +3154,6 @@ DeleteIndexRange(
}
if (line1 >= line2) {
-
/*
* Invalidate any selection retrievals in progress, assuming we didn't
* check for this case above.
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 987d376..422a7f7 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * $Id: ttkTheme.c,v 1.6.2.3 2007/12/04 17:05:20 dgp Exp $
+ * $Id: ttkTheme.c,v 1.6.2.4 2007/12/12 14:13:10 dgp Exp $
*/
#include <stdlib.h>
@@ -1497,22 +1497,24 @@ static int StyleElementNamesCmd(
}
/* + style element options $element --
+ * Return list of element options for specified element
*/
static int StyleElementOptionsCmd(
ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
{
- StylePackageData *pkgPtr = (StylePackageData *)clientData;
+ StylePackageData *pkgPtr = clientData;
Ttk_Theme theme = pkgPtr->currentTheme;
- Tcl_HashEntry *entryPtr;
+ const char *elementName;
+ ElementImpl *elementImpl;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 3, objv, "element");
return TCL_ERROR;
}
- entryPtr = Tcl_FindHashEntry(&theme->elementTable, Tcl_GetString(objv[3]));
- if (entryPtr) {
- ElementImpl *elementImpl = (ElementImpl *)Tcl_GetHashValue(entryPtr);
+ elementName = Tcl_GetString(objv[3]);
+ elementImpl = Ttk_GetElement(theme, elementName);
+ if (elementImpl) {
Ttk_ElementSpec *specPtr = elementImpl->specPtr;
Ttk_ElementOptionSpec *option = specPtr->options;
Tcl_Obj *result = Tcl_NewListObj(0,0);
@@ -1527,9 +1529,7 @@ static int StyleElementOptionsCmd(
return TCL_OK;
}
- Tcl_AppendResult(interp,
- "element ", Tcl_GetString(objv[3]), " not found",
- NULL);
+ Tcl_AppendResult(interp, "element ", elementName, " not found", NULL);
return TCL_ERROR;
}
diff --git a/tests/text.test b/tests/text.test
index e115d43..6a05a3b 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.46 2006/10/17 10:21:50 patthoyts Exp $
+# RCS: @(#) $Id: text.test,v 1.46.2.1 2007/12/12 14:13:10 dgp Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -423,6 +423,15 @@ test text-8.24 {TextWidgetCmd procedure, "replace" option with peers, undo} {
lappend res 1
}
} {foo 0 1}
+test text-8.25 {TextWidgetCmd procedure, "replace" option crash} -setup {
+ destroy .tt
+} -body {
+ text .tt
+ .tt insert 0.0 foo\n
+ .tt replace end-1l end bar
+} -cleanup {
+ destroy .tt
+} -result {}
.t delete 1.0 end; .t insert 1.0 $prevtext