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)
commitf617c83058bb40a68dae5c9834acdda18b534de8 (patch)
tree2ad9d65ee687a3e69dd26b1cecdc9e5e817a8669
parentab3f233c1f2acb66be6fd409a52e396acbdf6964 (diff)
downloadtk-f617c83058bb40a68dae5c9834acdda18b534de8.zip
tk-f617c83058bb40a68dae5c9834acdda18b534de8.tar.gz
tk-f617c83058bb40a68dae5c9834acdda18b534de8.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;
}