Selective revocation method and device for document editor
By recording and calculating the execution order of user operations, selective undoing of any operation in the document editor is achieved, which solves the limitations of operation undoing in the existing technology and provides flexible undo and redo functions.
Patent Information
- Application Number
- CN202511038933.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-28
- Publication Date
- 2025-11-07
AI Technical Summary
Existing selective undo technology can only undo operations that are not conflicting or related, which has significant limitations, high complexity, and cannot undo arbitrary operations.
By recording the execution order of user operations, storing the operations using a linear data structure, calculating the offsetting operation of the target operation, and removing or reproducing the execution effect of the target operation in the current document state without affecting non-target operations, selective undoing of any operation is achieved.
Users can undo any editing operation at any time, and the system will restore to the specified state, providing a better interactive experience and avoiding losses caused by accidental operations.
Smart Images

Figure CN120909842A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of file processing, and in particular to a selective undo method and device of a document editor, a computing device and a computer readable storage medium. BACKGROUND
[0002] Undo is an important error recovery mechanism of a document editor, and is one of indispensable operation functions of the document editor. A user can use an undo operation to recover from an error operation.
[0003] At present, most of document editors provide a single-step chronological undo, that is, each time the user is allowed to undo or redo the last step of operation.
[0004] Another more flexible and practical undo function is selective undo, that is, the user is allowed to select any operation in the operation history to undo or redo. For example, when the user wants to undo the third last operation, the chronological undo needs to undo the first last operation, then undo the second last operation, and finally undo the operation that the user wants to undo. The selective undo can directly undo the third last operation.
[0005] Compared with the chronological undo, the selective undo has higher flexibility and convenience: the user can use chronological undo, or undo in other ways.
[0006] The existing selective undo technical solution only allows operations without conflicts / associations to be undone, and operations with conflicts / associations can only be undone after the operations on which or associated with the target operation are undone.
[0007] Therefore, the selective undo method of the prior art has great limitations: not any operation can be undone or redone, and the undo operation depends on the length of the history operation, and has high complexity. SUMMARY
[0008] In order to solve the problems of the prior art, the embodiments of the present application provide a selective undo method and device of a document editor, a computing device and a computer readable storage medium, so that the user can undo any editing operation performed in the document editor at a certain moment, instead of undoing the last operation each time.
[0009] The technical solution of the present application is implemented as follows:
[0010] A selective undo method of a document editor, the method comprising:
[0011] Recording user operations of editing a document, recording the user operations in a linear data structure according to the execution order of the user operations, each element of the linear data structure being arranged according to the operation order of the user;
[0012] Selecting a user operation in the record, judging whether the user is undoing or redoing a target operation in the linear data structure according to the user's selection, the target operation being the user-selected operation, the user-selected operation being the operation of the user editing the document;
[0013] Calculating a cancel operation of the target operation, the cancel operation removing or reproducing the execution effect of the target operation in the current document state without affecting the execution effect of non-target operations;
[0014] Executing the cancel operation of the target operation, and reverting the current document state to the desired document state;
[0015] Recording the undo action of the user, and marking the undo action of the user in the linear data structure of recording the user operations.
[0016] Preferably, the recording user operations of editing a document, recording the user operations in a linear data structure according to the execution order of the user operations specifically comprises:
[0017] Recording the user operations according to the execution order, earlier execution being earlier and later execution being later;
[0018] Marking the initial state of each user operation as un-undo, changing to an undo state when a user operation is undone, and changing to an un-undo state when an undo state user operation is redone;
[0019] Assigning a unique identifier to each user operation, the identifier being used to find each user operation.
[0020] Preferably, the selecting a user operation in the record, judging whether the user is undoing or redoing a target operation in the linear data structure according to the user's selection specifically comprises:
[0021] Obtaining the identifier of the selected user operation, and finding the target operation in the record according to the identifier;
[0022] According to the state of the target operation, judging whether the undo or redo action is executable, the redo action being executable if the target operation has been undone, and the undo action being executable if the target operation has not been undone;
[0023] According to the execution action judgment result, judging whether to continue, and stopping if the action is not executable.
[0024] Preferably, the computing the cancel operation of the target operation, which removes or reproduces the execution effect of the target operation in the current document state, but does not affect the execution effect of non-target operation, specifically includes:
[0025] S100, according to the user operation history record OH, computing the independent operation sequence L1+[O]+L2, the operation sequence represents the state S of the document without canceling the target operation O n-1 , the state S n-1 represents the document state S n-1 =S L1+[O]+L2 obtained by executing the operation sequence from the initial state, wherein L1 contains the operation before O in OH, and L2 contains the operation after O in OH; L1+[O] represents the state S L1+[O] of the document without canceling the target operation O but all the canceled operations in L1 are canceled.
[0026] S200, obtaining the inverse operation of O to cancel the execution effect of O in the state S L1+[O] ;
[0027] S300, computing the conversion operation to cancel the execution effect of O in the document state S L1+[O]+L2 .
[0028] Preferably, the computing the independent operation sequence L1+[O]+L2 according to the user operation history record OH, the operation sequence represents the state S of the document without canceling the target operation O n-1 , the state S n-1 represents the document state S n-1 =S L1+[O]+L2 obtained by executing the operation sequence from the initial state, specifically includes:
[0029] Defining a computing unit to make the conversion function T(O1, O2) change the execution parameter of operation O1, so that after executing O2, the changed O1 can obtain the same execution effect as the original O1;
[0030] Defining a composite computing LT and LST to apply the conversion function T to the operation sequence;
[0031] Calling the composite computing LST to process the operation after O in OH, obtaining the operation sequence L2;
[0032] Adding O in front of L2, and calling the conversion function LST again to process the operation before O in OH, obtaining the operation sequence L1.
[0033] Preferably, the computing the conversion operation of O In the document state S L1+[O]+L2 The undoing execution effect of O specifically includes: calling the composite calculation LT processing and the conversion of L2.
[0034] Preferably, the canceling operation of the execution target operation, which rolls back the current document state to the desired document state, specifically includes:
[0035] If it is an undo action, calling the editor to execute to undo the execution effect of O; if it is a redo action, calling the editor to execute the inverse operation to reproduce the execution effect of O.
[0036] Preferably, the recording of the undo action of the user specifically includes:
[0037] If it is an undo action, marking the state of O in the record as being undone; if it is a redo action, marking the state of O in the record as not being undone.
[0038] In a second aspect, the embodiments of the present application further provide a computing device, which comprises a processor and a memory, the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method as described above.
[0039] In a third aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, the computer program comprises program instructions, and the program instructions, when executed by a processor, cause the processor or a calculator to execute the method as described above.
[0040] The embodiments of the present application have the beneficial effects that: at a certain time, the user can undo any certain editing operation executed in the editor, and is not limited to undoing the last operation each time, and the undoing can realize that after all operations starting from the time t are undone, the system is restored to the state at the time t, regardless of the order in which the user undoes. With the support of the embodiments of the present application, the user can not only undo the operations one by one from the back to the front, but also can undo multiple operations (adjacent or not adjacent) in any order, and the selective undoing operation function can help the user to obtain a better interactive experience and avoid the loss caused by arbitrary misoperation. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 is the canceling operation flowchart of the computing target operation of the embodiments of the present application;
[0042] Figure 2is a composite calculation LST flowchart of an embodiment of the present application;
[0043] Figure 3 is a composite calculation LT flowchart of an embodiment of the present application;
[0044] Figure 4 is a block diagram of a computing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the specific embodiments of the present application will be described below with reference to the drawings. Obviously, the drawings in the following description only represent some embodiments of the present application, and for those skilled in the art, other drawings can be obtained from these drawings without creative labor, and other embodiments can also be obtained.
[0046] In order to make the drawing simple, only the parts related to the invention are shown in each drawing, which does not represent the actual structure of the product. In addition, in order to make the drawing simple and easy to understand, in some drawings, only one of the parts with the same structure or function is shown, or only one of them is marked. In the embodiments of the present application, "one" not only means "only one", but also means "more than one". The embodiments of the technical solutions of the present application will be described in detail below mainly taking some specific embodiments as examples.
[0047] A selective undo method of a document editor, the method comprising:
[0048] S1, record the user operation of the user editing the document, record the user operation in a linear data structure according to the execution order of the user operation, each element of the linear data structure is arranged according to the operation order of the user;
[0049] For example, the operation executed first is in front, and the operation executed later is in back;
[0050] S2, select the user operation in the record, according to the user's selection, judge whether the user undoes or redoes the target operation in the linear data structure, the target operation is the operation selected by the user, the operation selected by the user refers to the operation of the user editing the document;
[0051] For example, deleting a paragraph of text or inserting a paragraph of text, and undoing or redoing refers to the user's action, which corresponds to Undo and Redo respectively;
[0052] S3, calculate the cancellation operation of the target operation, the cancellation operation removes or reproduces the execution effect of the target operation under the current document state, but does not affect the execution effect of the non-target operation;
[0053] For example, a user wants to undo an operation by performing a counter operation. For example, a user deletes a piece of text to generate an operation, and the user wants to undo the deletion operation, a counter operation should be performed, which should be inserted in the same position and the same text.
[0054] S4, performing a counter operation of the target operation to roll back the current document state to the desired document state;
[0055] S5, recording the undo action of the user, and marking the undo action of the user in the linear data structure recording the user operations.
[0056] Preferably, the recording of the user operations of the user editing the document according to the execution order of the user operations comprises:
[0057] The user operations are recorded according to the execution order, and the operations executed earlier are recorded earlier, and the operations executed later are recorded later;
[0058] The initial state of each user operation is marked as un-undone, and when a user operation is undone, the state is changed to undone, and when the undone user operation is redone, the state is changed to un-undone;
[0059] Each user operation is assigned a unique identifier, and the identifier is used to find each user operation.
[0060] Preferably, the selecting of the user operation in the record according to the user's selection to determine whether the user wants to undo or redo the target operation in the linear data structure comprises:
[0061] The identifier of the selected user operation is obtained, and the target operation is found in the record according to the identifier;
[0062] According to the state of the target operation, it is determined whether the undo or redo action is executable, if the target operation is undone, the redo action is executable, and if the target operation is not undone, the undo action is executable;
[0063] If the operation has been undone, the operation cannot be undone again; if the operation has not been undone, the operation cannot be redone again.
[0064] According to the execution action determination result, it is determined whether to continue, if the action is not executable, the operation is stopped.
[0065] Preferably, the calculating of the counter operation of the target operation comprises:
[0066] S100. Based on the user operation history OH, calculate the independent operation sequence L1+[O]+L2, where the operation sequence represents the state S of the document without canceling the target operation O. n-1 The state S n-1 This indicates that the document state S is obtained by performing the operation sequence from the initial state. n-1 =S L1+[O]+L2 Where L1 contains operations in OH that precede O, and L2 contains operations in OH that follow O; L1+[O] represents the state S when the target operation O is not undone in the document but all undone operations in L1 are undone. L1+[O] ;
[0067] S200, Obtain the inverse operation of O In state S L1+[O] Cancel the effect of O;
[0068] S300, Calculation Conversion operation In document state S L1+[O]+L2 Cancel the effect of O.
[0069] In this embodiment of the invention, the target operation refers to the operation that is selected by the user in the record; the non-target operation refers to the operation that is not selected by the user.
[0070] Please refer to the instruction manual for detailed procedures. Figure 1 The flowchart shows the specific process of canceling out the target operation.
[0071] Preferably, the step of calculating an independent operation sequence L1+[O]+L2 based on the user's operation history, wherein the operation sequence represents the state S of the document when the target operation O is not undone. n-1 The state S n-1 This indicates that the document state S is obtained by performing the operation sequence from the initial state. n-1 =S L1+[O]+L2 Specifically, it includes:
[0072] Define a computation unit so that the transformation function T(O1,O2) changes the execution parameters of operation O1, so that executing O2 and then executing the modified O1 can achieve the same execution effect as the original O1;
[0073] The conversion function T(O1,O2) means that, assuming O1 and O2 are insertion operations, O1 inserts string s1 at position p1, and O2 inserts string s2 at position p2; the insertion positions of the operations are changed according to their positional relationship. Specifically:
[0074] If p1 > p2, the converted insertion position should be p1 + the length of s2. Otherwise, the converted insertion position is unchanged.
[0075] The meaning expressed here is that O2 moves the insertion position of O1, and the conversion of O1 takes into account the influence of the execution effect of O2 on it.
[0076] The composite calculation LT and LST applies the conversion function T to the operation sequence;
[0077] The composite calculation LST processes the operations in the user operation history record OH after O to obtain the operation sequence L2;
[0078] The calculation process of the composite calculation LST is shown in the accompanying drawings, which will not be described here one by one. Figure 2
[0079] O is added to the front of L2, and the conversion function LST is called again to process the operations in the user operation history record OH before O to obtain the operation sequence L1.
[0080] Preferably, the calculation of the conversion operation The undoing of the execution effect of O in the document state SL1 + [O] + L2 specifically includes: calling the composite calculation LT to process and the conversion of L2.
[0081] The calculation process of the composite calculation LT is shown in the accompanying drawings, which will not be described here one by one. Figure 3
[0082] Preferably, the execution of the counter operation of the target operation specifically includes:
[0083] If it is an undo action, the editor is called to execute to undo the execution effect of O; if it is a redo action, the editor is called to execute the inverse operation to reproduce the execution effect of O.
[0084] Preferably, the recording of the undo action of the user specifically includes:
[0085] If it is an undo action, mark the state of O in the record as undone; if it is a redo action, mark the state of O in the record as not undone.
[0086] The embodiment of the present application has the beneficial effect that at a certain time, the user can undo any certain editing operation performed in the editor, and is not limited to undoing the last operation each time, and the undoing can achieve that after all operations from time t are undone, the system returns to the state at time t, regardless of the order in which the user undoes. With the support of the embodiment of the present application, the user can not only undo operations one by one from the back to the front, but also can undo multiple operations (adjacent or not adjacent) in any order, and the selective undoing operation function can help the user obtain a better interactive experience and avoid losses caused by arbitrary misoperations.
[0087] The following is described by taking a pure text document as an example. A pure text document usually represents changes of the document by two operations of insertion and deletion: INS(p, s) represents inserting a string s at position p, and DEL(p, s) represents deleting a string s starting from position p. The two operations are inverse operations of each other. The conversion function T of DEL to INS, i.e., O1 is a deletion operation DEL(p1, s1), and O2 is an insertion operation INS(p2, s2), is performed according to the following rules:
[0088] If p1+|s1| is less than or equal to p2, the converted result is DEL(p1, s1), and |s1| represents the length (the number of characters) of s1;
[0089] If p2 is less than or equal to p1, the converted result is DEL(p1+|s2|, s1);
[0090] If p2 is between p1 and p1+|s1|, the converted result is DEL(p1, s1[0, p2-p1]) and DEL(p1+|s2|, s1[p2-p1+1, |s1|-1]), that is, s1 is divided into two DEL operations, s1[0, p2-p1] represents a string from the 0th to the p2-p1th position of s1, and s1[p2-p1+1, |s1|-1] represents a string from the p2-p1+1th to the |s1|-1th position of s1, and s1[0, p2-p1] is connected with s1[p2-p1+1, |s1|-1] to obtain s1.
[0091] Suppose that the initial state S0 of a document is represented as "ab". The process of user editing the document to generate user operations O1 and O2 is as follows:
[0092] S1=S0●O1=S0●INS(1, Y) = "aYb";
[0093] S2=S0●O1●O2=S1●INS(1, X) = "aXYb";
[0094] The operations are numbered from 1. At this time, the user operation history record OH is expressed as [O1, O2] (O1 precedes O2), the identifier of O1 is 1, and the identifier of O2 is 2. Suppose the user selects to undo O1. According to the method provided by the present application, the following steps are executed:
[0095] According to the identifier of O1, the first operation in OH is found;
[0096] The state of O1 is not undone, and according to the judgment, the undo action is executable, and the execution is continued;
[0097] The cancellation operation of O1 is calculated, and the result is
[0098] According to the action type, the operation (the execution effect of O1 is removed) is executed;
[0099] According to the action type, the state of O1 is changed to undone.
[0100] Continuing the previous process, suppose the user selects to redo O1 after undoing O1. According to the method provided by the present application, the following steps are executed:
[0101] According to the identifier of O1, the first operation in OH is found;
[0102] The state of O1 is undone, and according to the judgment, the redo action is executable, and the execution is continued;
[0103] The cancellation operation of O1 is calculated, and the result is
[0104] According to the action type, the inverse operation of is executed, (the execution effect of O1 is reproduced);
[0105] According to the action type, the state of O1 is changed to not undone.
[0106] Suppose again that the user selects to undo O2 after undoing O1. According to the method provided by the present application, the following steps are executed:
[0107] According to the identifier of O2, the second operation in OH is found;
[0108] The state of O2 is not undone, and according to the judgment, the undo action is executable, and the execution is continued;
[0109] The cancellation operation of O1 is calculated, and the result is
[0110] According to the action type, the operation is executed (restored to S0).
[0111] According to the action type, the state of O1 is changed to be revoked.
[0112] In a third aspect, the present application is an embodiment further provides a computing device, comprising a processor, a memory, the memory is used to store a computer program, the computer program comprises program instructions, the processor or computer is configured to invoke the program instructions, and execute the method as described above.
[0113] In a fourth aspect, the present application is an embodiment further provides a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program comprises program instructions, the program instructions, when executed by a processor or computer, cause the processor or computer to execute the method as described above.
[0114] As shown in Figure 4 The embodiment of the present application provides a computing device, the computing device 1000 comprises a processor or computer (not shown in the figure) 1001 and a memory 1002, and the processor or computer 1001 and the memory 1002 can be connected with each other through a communication bus 1003. The communication bus 1003 can be a peripheral component interconnect (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus. The communication bus 1003 can be divided into an address bus, a data bus, a control bus and the like. For the convenience of representation, the memory 1002 is used to store a computer program, the computer program comprises program instructions, and the processor 1001 is configured to invoke the program instructions, and the above program comprises part or all steps for executing the method contained in the foregoing.
[0115] The processor 1001 can be a general central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above scheme program.
[0116] The memory 1002 can be read-only memory (ROM) or other type of static storage devices that can store static information and instructions, random access memory (RAM) or other type of dynamic storage device that can store information and instructions, electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium capable of storing desired program code in form of instructions or data structures and that can be accessed by a computer, but not limited to. The memory can exist independently, and be connected with the processor through the bus. The memory can also be integrated with the processor.
[0117] The computing device 1000 can also include a communication module 1004 and a display 1005. The communication module 1004 can be in communication connection with the optical tracking device. The communication module 1004 can be a wireless communication module (such as a WiFi module, a Bluetooth module, etc.) or a wired communication module.
[0118] In addition, the computing device 1000 can also include a communication interface (such as a USB interface, a microphone interface, etc.), an antenna, and other general components, which are not described here in detail.
[0119] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0120] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can refer to the related description of other embodiments.
[0121] In several embodiments provided in the present application, it should be understood that the disclosed apparatus can be implemented in other manners. For example, the division of the apparatus embodiments described above is merely an example, and the division can be other forms. For example, multiple units or components can be combined or integrated into another apparatus, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, apparatuses or units, and can be in electrical, mechanical or other forms.
[0122] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0123] In addition, the functional units in each embodiment of the application can be integrated into a processing unit, or each unit can be a physically independent unit, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware or in the form of a software program module.
[0124] The integrated unit, if implemented in the form of a software program module and sold or used as an independent product, can be stored in a computer readable memory. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or the whole or part of the technical solutions can be embodied in the form of a software product, which is stored in a memory and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0125] Those of ordinary skill in the art can understand that all or part of the steps of the various methods in the above embodiments can be completed by a program instructing relevant hardware, and the program can be stored in a computer readable memory, which can include a flash disk, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.
[0126] The above has carried out the detailed introduction to the embodiment of the application, the principle and implementation mode of the embodiment of the application are described by applying specific examples, the above embodiment is only used for helping understanding the method of the application and its core idea; at the same time, for the general technical personnel in the art, according to the idea of the application, the specific implementation mode and application range will have changes, and the above is not understood as the limitation of the application.
[0127] It should be noted that the above embodiments can be freely combined as needed. The above is only a preferred embodiment of the present application, and it should be pointed out that for ordinary technical personnel in the technical field, without departing from the principle of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.
Claims
1. A method of selective undoing in a document editor, characterized by, The method comprises: Recording user operations of editing a document, recording the user operations in a linear data structure according to the execution sequence of the user operations, each element of the linear data structure being arranged according to the operation sequence of the user; Selecting the user operations in the record, judging whether the user is undoing or redoing a target operation in the linear data structure according to the selection of the user, the target operation being the operation selected by the user, the operation selected by the user being the operation of editing the document by the user; Calculating the cancellation operation of the target operation, the cancellation operation removing or reproducing the execution effect of the target operation in the current document state but not affecting the execution effect of non-target operations; Executing the cancellation operation of the target operation to return the current document state to the desired document state; Recording the undo action of the user, marking the undo action of the user in the linear data structure of recording the user operations.
2. The selective undo method of a document editor according to claim 1, wherein, The recording of the user operations of editing a document, recording the user operations in a linear data structure according to the execution sequence of the user operations specifically comprises: Recording the user operations according to the execution sequence, the operations executed earlier being arranged in front and the operations executed later being arranged behind; Marking the initial state of each user operation as un-undo, changing the state to un-undo when a user operation is undone, and changing the state to un-undo when the user operation in the un-undo state is redone; Assigning a unique identifier to each user operation, the identifier being used to find each user operation.
3. The selective undo method of a document editor according to claim 2, wherein, The selection of the user operations in the record, judging whether the user is undoing or redoing a target operation in the linear data structure according to the selection of the user specifically comprises: Obtaining the identifier of the selected user operation, finding the target operation in the record according to the identifier; Judging whether the undo or redo action is executable according to the state of the target operation, the redo action being executable if the target operation has been undone, and the undo action being executable if the target operation has not been undone; Judging whether to continue according to the execution action judgment result, and stopping if the action is not executable.
4. The selective undo method of a document editor according to Claim 1, wherein, The calculation of the cancellation operation of the target operation, the cancellation operation removing or reproducing the execution effect of the target operation in the current document state but not affecting the execution effect of non-target operations specifically comprises: S100. Based on the user operation record, calculate the independent operation sequence L1+[O]+L2, where the operation sequence represents the state S of the document without canceling the target operation O. n-1 The state S n-1 This indicates that the document state S is obtained by performing the operation sequence from the initial state. n-1 =S L1+[O]+L2 Where L1 contains operations in the user operation history OH that precede O, and L2 contains operations in the user operation history OH that follow O; L1+[O] represents the state S of the document if the target operation O has not been undone and all undone operations in the user operation history OH that precede O have been undone. L1+[O] ; S200, obtaining the inverse operation of O In state S L1+[O] the execution effect of O is reversed; S300, compute the conversion operation the execution effect of the undo O in the document state S L1+[O]+L2 under the document state S 5. The selective undo method of a document editor according to claim 4, wherein, The operation sequence L1+[O]+L2 is calculated according to the user operation record, and the operation sequence represents the state S of the document without the target operation O n-1 The state S n-1 represents the state S of the document after performing the operation sequence from the initial state n-1 =S L1+[O]+L2 Specifically, the method comprises the following steps: Defining a calculation unit to make a conversion function T(O1, O2) change the execution parameters of an operation O1 to achieve the same execution effect as the original O1 after executing O2 and then executing the changed O1; Defining a composite calculation LT and LST to apply the conversion function T to the operation sequence; Calling the composite calculation LST to process the operations in the user operation history record OH after O, obtaining an operation sequence L2; Adding O in front of L2, and calling the conversion function LST again to process the operations in the user operation history record OH before O, obtaining an operation sequence L1.
6. The selective undo method of a document editor according to claim 4, wherein, The computation The conversion operation The execution effect of undo O in the document state S L1+[O]+L2 specifically includes invoking the composite computation LT processing and conversion with L2.
7. The selective undo method of a document editor according to claim 4, wherein, The execution of the cancellation operation of the target operation to return the current document state to the desired document state specifically comprises: If it is an undo action, the editor is invoked to perform the inverse of the execution effect of O; if it is a redo action, the editor is invoked to perform the inverse operation of O to reproduce the execution effect of O.
8. The selective undo method of a document editor according to claim 4, wherein, The recording of the undo action of the user in the linear data structure of recording the user operations specifically comprises: If it is an undo action, marking the state of O in the record as un-undo; if it is a redo action, marking the state of O in the record as un-undo.
9. A computing device, comprising: The computing device comprises a processor, a memory for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor or a calculator to perform the method according to any one of claims 1 to 8.