diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-02-21 12:11:12 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-02-21 12:11:12 (GMT) |
commit | 2d0096fbca6ae857e2d6711e058ca49ea3391e44 (patch) | |
tree | 5a5a63f94895b287d1b60dce0469ae97be3a7172 | |
parent | 9ee03b593e2411cc2c5404b827ecdde22d4d34b4 (diff) | |
download | tk-2d0096fbca6ae857e2d6711e058ca49ea3391e44.zip tk-2d0096fbca6ae857e2d6711e058ca49ea3391e44.tar.gz tk-2d0096fbca6ae857e2d6711e058ca49ea3391e44.tar.bz2 |
Re-fix [Bug 1799782].
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | generic/tkText.c | 24 |
2 files changed, 26 insertions, 11 deletions
@@ -1,9 +1,14 @@ +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-20 Joe English <jenglish@users.sourceforge.net> - * 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 <nijtmans@users.sf.net> 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 <<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: @@ -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 <<Modified>> * * Results: |