summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-04-07 19:32:29 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-04-07 19:32:29 (GMT)
commit6b0ad3ecbb13963f417e8a56292c24679f23126e (patch)
tree2ad9d65ee687a3e69dd26b1cecdc9e5e817a8669
parentc97db25d011e7cef5dbb37cf3ce0a2a50bcbb5ca (diff)
downloadtk-6b0ad3ecbb13963f417e8a56292c24679f23126e.zip
tk-6b0ad3ecbb13963f417e8a56292c24679f23126e.tar.gz
tk-6b0ad3ecbb13963f417e8a56292c24679f23126e.tar.bz2
[.t edit undodepth/redodepth] return 0 when -undo false
-rw-r--r--generic/tkText.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index c293557..3114835 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -5232,13 +5232,15 @@ TextEditCmd(
}
break;
case EDIT_REDODEPTH: {
- int depth;
+ int depth = 0;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 1);
+ if (textPtr->sharedTextPtr->undo) {
+ depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 1);
+ }
Tcl_SetObjResult(interp, Tcl_NewIntObj(depth));
break;
}
@@ -5268,13 +5270,15 @@ TextEditCmd(
}
break;
case EDIT_UNDODEPTH: {
- int depth;
+ int depth = 0;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 3, objv, NULL);
return TCL_ERROR;
}
- depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 0);
+ if (textPtr->sharedTextPtr->undo) {
+ depth = TkUndoGetDepth(textPtr->sharedTextPtr->undoStack, 0);
+ }
Tcl_SetObjResult(interp, Tcl_NewIntObj(depth));
break;
}