From 38d2856d341358bf9c691157ae0ca2e8960e35df Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 15 Feb 2024 14:17:08 +1100 Subject: Perform validation of undo state when SCI_SETUNDOCURRENT called, setting status when invalid. --- doc/ScintillaDoc.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'doc/ScintillaDoc.html') diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 12f2be0eb..4a10d280f 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2063,9 +2063,9 @@ struct Sci_TextToFindFull {

The history should first be set up with SCI_PUSHUNDOACTIONTYPE, and - SCI_CHANGELASTUNDOACTIONTEXT then the save, current, and tentativ points set - with SCI_SETUNDOSAVEPOINT, SCI_SETUNDOCURRENT, and - SCI_SETUNDOTENTATIVE. + SCI_CHANGELASTUNDOACTIONTEXT then the save, current, and tentative points set + with SCI_SETUNDOSAVEPOINT, SCI_SETUNDOTENTATIVE, and + SCI_SETUNDOCURRENT.

SCI_PUSHUNDOACTIONTYPE(int type, position pos) appends an action to the undo stack @@ -2073,6 +2073,14 @@ struct Sci_TextToFindFull { SCI_CHANGELASTUNDOACTIONTEXT(position length, const char *text).

+

+ The last restoration API called should be SCI_SETUNDOCURRENT as this validates + the restored history and values against the document. For example, an undo history that could cause a negative + document length or inserting / removing text outside the document is invalid. + If the restored undo state is invalid then a failure status is set and the undo history cleared. + Check for failure with SCI_GETSTATUS. +

+

The current implementation may only work when the current and save point are the same and there is no tentative point.

-- cgit v1.2.3