From 2d0096fbca6ae857e2d6711e058ca49ea3391e44 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 21 Feb 2010 12:11:12 +0000 Subject: Re-fix [Bug 1799782]. --- ChangeLog | 13 +++++++++---- generic/tkText.c | 24 +++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67e2698..d6bb501 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ +2010-02-21 Donal K. Fellows + + * generic/tkText.c (TextEditCmd): [Bug 1799782]: Refix this, so that + <> events are issued when things change. + 2010-02-20 Joe English - * generic/ttk/ttkTreeview.c: Cache the result of the - last call to EndPosition() to avoid quadratic-time behavior - in the common cases where the treeview is populated - in depth-first or breadth-first order. + * generic/ttk/ttkTreeview.c: Cache the result of the last call to + EndPosition() to avoid quadratic-time behavior in the common cases + where the treeview is populated in depth-first or breadth-first + order. 2010-02-19 Jan Nijtmans diff --git a/generic/tkText.c b/generic/tkText.c index 6cd7072..d6e232a 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.95 2010/01/18 20:43:38 nijtmans Exp $ + * RCS: @(#) $Id: tkText.c,v 1.96 2010/02/21 12:11:13 dkf Exp $ */ #include "default.h" @@ -4317,6 +4317,7 @@ TkTextGetTabs( count = 0; for (i = 0; i < objc; i++) { char c = Tcl_GetString(objv[i])[0]; + if ((c != 'l') && (c != 'r') && (c != 'c') && (c != 'n')) { count++; } @@ -4351,8 +4352,8 @@ TkTextGetTabs( } prevStop = lastStop; - if (Tk_GetDoublePixelsFromObj (interp, textPtr->tkwin, objv[i], - &lastStop) != TCL_OK) { + if (Tk_GetDoublePixelsFromObj(interp, textPtr->tkwin, objv[i], + &lastStop) != TCL_OK) { goto error; } @@ -4411,7 +4412,7 @@ TkTextGetTabs( "tab alignment", 0, &index) != TCL_OK) { goto error; } - tabPtr->alignment = ((TkTextTabAlign)index); + tabPtr->alignment = (TkTextTabAlign) index; } /* @@ -5021,7 +5022,7 @@ TextEditCmd( Tcl_WrongNumArgs(interp, 3, objv, "?boolean?"); return TCL_ERROR; } else { - int setModified; + int setModified, oldModified; if (Tcl_GetBooleanFromObj(interp, objv[3], &setModified) != TCL_OK) { @@ -5034,13 +5035,22 @@ TextEditCmd( setModified = setModified ? 1 : 0; + oldModified = textPtr->sharedTextPtr->isDirty; textPtr->sharedTextPtr->isDirty = setModified; if (setModified) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_FIXED; } else { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } - GenerateModifiedEvent(textPtr); + + /* + * Only issue the <> event if the flag actually changed. + * However, degree of modified-ness doesn't matter. [Bug 1799782] + */ + + if ((!oldModified) != (!setModified)) { + GenerateModifiedEvent(textPtr); + } } break; case EDIT_REDO: @@ -5173,7 +5183,7 @@ TextGetText( * * GenerateModifiedEvent -- * - * Send an event that the text was modified. This is equivalent to + * Send an event that the text was modified. This is equivalent to: * event generate $textWidget <> * * Results: -- cgit v0.12