diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tkText.c | 15 |
2 files changed, 17 insertions, 3 deletions
@@ -1,3 +1,8 @@ +2010-02-21 Donal K. Fellows <dkf@users.sf.net> + + * generic/tkText.c (TextEditCmd): [Bug 1799782]: Refix this, so that + <<Modified>> events are issued when things change. + 2010-02-19 Donal K. Fellows <dkf@users.sf.net> * unix/installManPage: [Tcl Bug 2954638]: Correct behaviour of manual diff --git a/generic/tkText.c b/generic/tkText.c index 518af81..c1be9d9 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.79.2.5 2010/01/29 12:41:11 nijtmans Exp $ + * RCS: @(#) $Id: tkText.c,v 1.79.2.6 2010/02/21 13:23:13 dkf Exp $ */ #include "default.h" @@ -5000,7 +5000,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) { @@ -5013,13 +5013,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 <<Modified>> 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: |