summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-02-21 12:11:12 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-02-21 12:11:12 (GMT)
commit2d0096fbca6ae857e2d6711e058ca49ea3391e44 (patch)
tree5a5a63f94895b287d1b60dce0469ae97be3a7172 /generic/tkText.c
parent9ee03b593e2411cc2c5404b827ecdde22d4d34b4 (diff)
downloadtk-2d0096fbca6ae857e2d6711e058ca49ea3391e44.zip
tk-2d0096fbca6ae857e2d6711e058ca49ea3391e44.tar.gz
tk-2d0096fbca6ae857e2d6711e058ca49ea3391e44.tar.bz2
Re-fix [Bug 1799782].
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c24
1 files changed, 17 insertions, 7 deletions
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: