A text processing method, apparatus, device, and storage medium

CN116931741BActive Publication Date: 2026-10-16BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210344890.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2026-10-16
Estimated Expiration
2042-03-31

AI Technical Summary

Benefits of technology

[0043] The technical solution provided in this disclosure has at least the following advantages compared with the prior art:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116931741B_ABST
    Figure CN116931741B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text processing method, device and equipment and storage medium. First, in response to a undo operation, a text event sequence is obtained. The text event sequence includes at least one text event arranged in time sequence, each text event has a corresponding text display snapshot, and the at least one text event includes a text input event and a text deletion event. The last text event in the text event sequence is determined as a target text event. If it is determined that the target text event belongs to the text input event and the adjacent previous text event of the target text event belongs to the text deletion event, the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the adjacent previous text event of the target text event. In the present disclosure, after the user deletes some text and inputs new text again, the user can directly undo to the text display state before deleting the text by triggering the undo operation only once.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing, and more particularly to a text processing method, apparatus, device, and storage medium. Background Technology

[0002] Text input is widely used in people's work and life. Text input can include the input of text, letters, numbers and symbols.

[0003] Currently, during text input, if a user deletes some text and then enters new text, triggering an undo operation, the first undo operation corresponds to displaying the text in the state after the deletion. Only subsequent undo operations will display the text in the state before the deletion. For example, if a user changes "design software" in a text box to "design tools" by deleting "software" and then entering "tools," and needs to undo to the "design software" text display state, the user needs to do the following:

[0004] Step 1: Trigger the first undo operation. At this time, the text box displays "Design", which is the text display state after deleting "Software" from "Design Software".

[0005] Step 2: Trigger the second undo operation. At this time, the text box will display "Design Software", which is the text display state before the deletion of "Software" in "Design Software".

[0006] In practical applications, users expect that after the first trigger of the undo operation, the text display state before deleting "Software" from "Design Software" should be shown. In other words, the transition from "Design Tool" to "Design Software" should be direct, without displaying the text display state corresponding to the intermediate deletion operation. Therefore, improving the response efficiency of undo operations in this scenario, enabling a direct switch from the text display state of "Design Tool" to the text display state of "Design Software" that meets the user's expected text display effect, is a pressing technical problem that needs to be solved. Summary of the Invention

[0007] To address the aforementioned technical problems, this disclosure provides a text processing method. In a first aspect, this disclosure provides a text processing method, the method comprising:

[0008] In response to an undo operation, a text event sequence is acquired; wherein the text event sequence includes at least one text event arranged in chronological order, each text event has a corresponding text display snapshot, the text display snapshot is used to record the text display state when the text event is triggered, at least one text event includes a text input event and a text deletion event, the text input event consists of at least one input operation triggered consecutively, the text deletion event consists of at least one deletion operation triggered consecutively, and the next operation adjacent to the last deletion operation triggered in at least one deletion operation is an input operation;

[0009] The last text event in the text event sequence is identified as the target text event;

[0010] If it is determined that the target text event is a text input event, and the preceding text event is a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event.

[0011] In an optional implementation, the method further includes:

[0012] If it is determined that the target text event is a text input event, and the preceding text event adjacent to the target text event is not a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event.

[0013] In an optional implementation, the method further includes:

[0014] If the target text event is determined to be a text deletion event, the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event.

[0015] In one optional implementation, the triggering time interval between adjacent input operations in at least one input operation of a text input event is not greater than a preset duration threshold.

[0016] In an optional implementation, the method further includes:

[0017] When a target input operation is detected, a snapshot of the text display corresponding to the target input operation is obtained, and a timer is started to determine whether an input operation exists within a preset time threshold.

[0018] If it is determined that an input operation exists within the preset duration threshold, the timer is cleared and restarted, and the input operation is added to the text input event corresponding to the target input operation. The process of determining whether an input operation exists within the preset duration threshold continues until it is determined that no input operation exists within the preset duration threshold.

[0019] Obtain the text input event corresponding to the target input operation, and add the correspondence between the text input event and the text display snapshot to the text event sequence.

[0020] In an optional implementation, the method further includes:

[0021] When a target deletion operation is detected, a snapshot of the text display corresponding to the target deletion operation is obtained, and it is determined whether the next adjacent operation is a deletion operation.

[0022] If it is determined that the next adjacent operation is a deletion operation, then the next adjacent operation is added to the text deletion event corresponding to the target deletion operation, and the process of determining whether the next adjacent operation is a deletion operation continues until it is determined that the next adjacent operation is not a deletion operation.

[0023] Obtain the text deletion event corresponding to the target deletion operation, and add the correspondence between the text deletion event and the text display snapshot to the text event sequence.

[0024] In one optional implementation, at least one text event further includes a preset type text input event, which consists of an input operation triggered between calls to a corresponding start callback function and an end callback function.

[0025] In an optional implementation, the method further includes:

[0026] When a call to the start callback function is detected, a snapshot of the text display corresponding to the start callback function is obtained;

[0027] When a call to the end callback function corresponding to the start callback function is detected, the input operations triggered between the calls to the start callback function and the end callback function will be added to the preset type text input event corresponding to the start callback function.

[0028] Add the correspondence between the preset type of text input event corresponding to the start callback function and the text display snapshot to the text event sequence.

[0029] In an optional implementation, the method further includes:

[0030] If it is determined that the target text event belongs to a preset type of text input event, and the preceding text event of the target text event belongs to a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event of the target text event.

[0031] In an optional implementation, the method further includes:

[0032] If it is determined that the target text event belongs to a preset type of text input event, and the preceding text event adjacent to the target text event does not belong to a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event.

[0033] In one optional implementation, before displaying the text corresponding to the undo operation, the method further includes:

[0034] Get a snapshot of the text display corresponding to the undo operation;

[0035] In response to the redo operation corresponding to the undo operation, a snapshot of the text corresponding to the undo operation is displayed, and the text corresponding to the redo operation is displayed.

[0036] Secondly, this disclosure provides a text processing apparatus, the apparatus comprising:

[0037] The first acquisition module is used to acquire a text event sequence in response to an undo operation; wherein the text event sequence includes at least one text event arranged in chronological order, each text event has a corresponding text display snapshot, the text display snapshot is used to record the text display state when the text event is triggered, at least one text event includes a text input event and a text deletion event, the text input event consists of at least one input operation triggered consecutively, the text deletion event consists of at least one deletion operation triggered consecutively, and the next operation adjacent to the last deletion operation triggered in at least one deletion operation is an input operation;

[0038] The first determining module is used to determine the last text event in the text event sequence as the target text event;

[0039] The first display module is used to display the text corresponding to the undo operation based on the text display snapshot corresponding to the preceding text event when it is determined that the target text event belongs to a text input event and the preceding text event of the target text event belongs to a text deletion event.

[0040] Thirdly, this disclosure provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to implement the above-described method.

[0041] Fourthly, this disclosure provides a text processing device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described method.

[0042] Fifthly, this disclosure provides a computer program product, which includes a computer program / instructions that, when executed by a processor, implement the above-described method.

[0043] The technical solution provided in this disclosure has at least the following advantages compared with the prior art:

[0044] This disclosure provides a text processing method, which includes: first, in response to an undo operation, acquiring a text event sequence; wherein the text event sequence includes at least one text event arranged in chronological order, each text event having a corresponding text display snapshot, the text display snapshot being used to record the text display state when the text event is triggered, the at least one text event including a text input event and a text deletion event, the text input event consisting of at least one consecutively triggered input operation, and the text deletion event consisting of at least one consecutively triggered deletion operation; determining the last text event in the text event sequence as the target text event; if the target text event is determined to be a text input event, and the preceding text event adjacent to the target text event is a text deletion event, then based on the text display snapshot corresponding to the preceding text event adjacent to the target text event, displaying the text corresponding to the undo operation. Therefore, in this disclosure, after a user deletes some text and re-enters new text, they can directly revert to the text display state before the text deletion by triggering only one undo operation, improving the response efficiency of the undo operation and meeting the user's desired text display effect. Attached Figure Description

[0045] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0046] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0047] Figure 1 A flowchart of a text processing method provided in this disclosure embodiment;

[0048] Figure 2 A schematic diagram illustrating the formation process of a text input event provided in an embodiment of this disclosure;

[0049] Figure 3 A schematic diagram illustrating the formation process of a text deletion event provided in an embodiment of this disclosure;

[0050] Figure 4 A schematic diagram illustrating the formation process of a preset type text input event provided in an embodiment of this disclosure;

[0051] Figure 5 This is a schematic diagram of the structure of a text processing device provided in an embodiment of the present disclosure;

[0052] Figure 6 This is a schematic diagram of the structure of a text processing device provided in an embodiment of the present disclosure. Detailed Implementation

[0053] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0054] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0055] In one related technology, a user changes "123" in a text box to "145" by deleting "23" and then entering "45". If the user needs to revert to the original "123" text display state, the operations they need to perform include:

[0056] Step 1: Trigger the first undo operation; at this point, the text box displays "1".

[0057] Step 2: Trigger the second undo operation, at which point "123" will be displayed in the text box.

[0058] Clearly, currently, to directly undo the display from "145" to "123", the user needs to trigger the above two undo operations, which is cumbersome and has low response efficiency. Therefore, how to improve the response efficiency of the undo operation in the above scenario, so that the text display state can be directly switched from "145" to "123" to meet the user's expected text display effect, is a technical problem that urgently needs to be solved.

[0059] To achieve the desired text display effect for users, this disclosure provides a text processing method. First, in response to an undo operation, a text event sequence is acquired. This sequence includes at least one text event arranged chronologically, each with a corresponding text display snapshot. The snapshot records the text display state when the event is triggered. Each text event includes a text input event and a text deletion event. The text input event consists of at least one consecutively triggered input operation, and the text deletion event consists of at least one consecutively triggered deletion operation. The last text event in the sequence is identified as the target text event. If the target text event is determined to be a text input event, and the preceding text event is a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event. Therefore, in this disclosure, after deleting some text and re-entering new text, users can directly revert to the text display state before the deletion by triggering only one undo operation, improving the response efficiency of the undo operation and satisfying the user's desired text display effect.

[0060] Based on this, the present disclosure provides a text processing method, referring to... Figure 1 The flowchart below illustrates a text processing method provided in this disclosure, which includes:

[0061] S101: In response to the undo operation, obtain the text event sequence;

[0062] The text event sequence includes at least one text event arranged in chronological order. Each text event has a corresponding text display snapshot, which is used to record the text display state when the text event is triggered. The at least one text event includes a text input event and a text deletion event. The text input event consists of at least one input operation triggered consecutively, and the text deletion event consists of at least one deletion operation triggered consecutively. The next operation adjacent to the last deletion operation triggered in the at least one deletion operation is an input operation.

[0063] In this embodiment of the disclosure, the text event sequence may include at least one text input event and at least one text deletion event. Each text event has a corresponding text display snapshot, wherein the text display snapshot is used to record the text display state when the text event is triggered. The initial display state of each text event in the text event sequence can be determined by the text display snapshot. Specifically, the initial display state of each file event in the text event sequence can be determined by dot notation. The specific dot notation method will be described in detail later.

[0064] In this embodiment of the disclosure, a text input event consists of at least one consecutively triggered input operation, and the triggering time interval between adjacent input operations in the text input event is no greater than a preset duration threshold. The input operation includes one or more combinations of letters, numbers, symbols, strings, etc., input by the user.

[0065] In practical applications, the preset duration threshold can be a fixed duration threshold, such as 1 second set directly by the user. The preset duration threshold can also be set according to the input type of the text input event, with different preset duration thresholds for different input types. For example, the preset duration threshold for English input type text input events can be set to 1 second, and the preset duration threshold for numeric input type text input events can be set to 0.5 seconds. The specific method for setting the preset duration threshold is not specifically limited in this embodiment.

[0066] In one optional implementation, when a target input operation is detected, a text display snapshot corresponding to the target input operation is acquired. This text display snapshot is used to record the text display state when the target input operation is triggered. Specifically, this can be achieved by starting a timer when the target input operation is triggered, recording the text display state before the text input event begins, and starting a timer to determine if an input operation exists within a preset duration threshold. If an input operation is determined to exist within the preset duration threshold, the input operation is added to the text input event corresponding to the target input operation, where the time interval between two adjacent input operations in the text input event corresponding to the target input operation is not greater than the preset duration threshold. The timer is then reset and restarted, and the process of determining whether an input operation exists within the preset duration threshold continues until it is determined that no input operation exists within the preset duration threshold. At this point, the timer is reset to end, and the text display state corresponding to the end of the text input event is recorded. Specifically, when the most recent input operation is added to the text input event corresponding to the target input operation, the timer is reset and restarted. When it is determined that no input operation exists within the preset duration threshold, the timer is reset to end, and the text display state at the end of the text input event is recorded.

[0067] To illustrate the text input event formation process provided in this embodiment, a schematic diagram of the text input event formation process is provided, as shown below. Figure 2As shown. Assume the target input operation corresponds to the input of an English letter, and the preset duration threshold is 1 second. When the input operation of the English letter A is detected, a snapshot of the text display corresponding to the input of A is obtained. Specifically, the text display state corresponding to the triggering of input A is recorded by dot notation. At this time, dot notation begins, and the text display snapshot is blank. A timer is started to determine if an input operation exists within 1 second. If input B exists within 1 second, B is added to the text input event corresponding to input A, and the timer is reset and restarted. The above steps to determine if an input operation exists within 1 second are executed. If input C exists within 1 second, input C is added to the text input event corresponding to input operation A, until it is determined that no input operation exists within 1 second.

[0068] In this embodiment of the disclosure, when it is determined that there is no input operation within a preset time threshold, the text input event corresponding to the target input operation is obtained, and the correspondence between the text input event and the text display snapshot is added to the text event sequence. This allows the user to directly display the text based on the text display snapshot corresponding to the text input event after triggering an undo operation. In other words, the display state before the text input event can be displayed without performing other operations, which simplifies the complexity of user operations and improves the response efficiency of the undo operation.

[0069] like Figure 2 As shown, in the above text input event, D is added to the text input event corresponding to input A. The timer is reset and then restarted. If no input operation occurs within 1 second, the end marker is triggered, and the text display state after the end of the text input event is recorded. That is, the text display state of the text input event at this time is "ABCD". At this time, if the user triggers an undo operation, the text display state can be directly switched from "ABCD" to blank, thus skipping the steps of deleting D, C, B, and A in sequence, improving the response efficiency of the undo operation and simplifying the complexity of user operation.

[0070] In this embodiment of the disclosure, a text deletion event consists of at least one consecutively triggered deletion operation, wherein the next operation immediately following the last triggered deletion operation is an input operation. In practical applications, a text deletion event may correspond to one or more of the letters, numbers, symbols, strings, etc., included in a text input event. The next operation immediately following the last deletion operation triggered by the user in the same text deletion event is not a deletion operation; for example, it may be an input operation.

[0071] In one optional implementation, when a target deletion operation is detected, a text display snapshot corresponding to the target deletion operation is acquired. This text display snapshot is used to record the text display state when the target deletion operation is triggered. Specifically, this can be achieved by starting to mark points when the first deletion operation is triggered, recording the text display state before the text deletion event begins deletion, and determining whether the next adjacent operation is a deletion operation. If it is determined that the next adjacent operation is a deletion operation, then the next adjacent operation is added to the text deletion event corresponding to the target deletion operation, and the process of determining whether the next adjacent operation is a deletion operation continues until it is determined that the next adjacent operation is not a deletion operation. Specifically, when it is determined that the next adjacent operation is an input operation, the end of the marking can be triggered, and the text display state at the end of the text deletion event can be recorded.

[0072] To illustrate the implementation process of the text deletion event provided in this embodiment, this embodiment provides a schematic diagram of the formation process of the text deletion event, as shown below. Figure 3 As shown.

[0073] Assuming the target deletion operation corresponds to deleting "tool" in "design tool", when the first deletion operation on "l" is detected, a snapshot of the text display corresponding to the deletion of "l" is obtained. Specifically, a point can be marked when the deletion operation "l" is triggered, recording the text display state before the text deletion event begins. At this time, the text display state is "design tool". When it is determined that the next adjacent operation is to delete o, o, t in sequence, these deletion operations are added to the text deletion event corresponding to the target deletion operation, and the process continues to determine whether the next adjacent operation is a deletion operation.

[0074] In practical applications, when it is determined that the next adjacent operation is not a deletion operation, the text deletion event corresponding to the target deletion operation is obtained, and the correspondence between the text deletion event and the text display snapshot is added to the text event sequence so as to trigger an undo operation. The text is then displayed directly based on the text display snapshot corresponding to the text deletion event. That is, without performing other operations, the text deletion event corresponding to the target deletion operation is skipped, and the display state before the text deletion event is displayed directly, which simplifies the complexity of user operations.

[0075] like Figure 3As shown, when adding the deletions of l, o, o, and t to the text deletion event corresponding to the target deletion operation, if the next adjacent operation is determined to be inputting A, an end marker is triggered, and the text display state at the end of the text deletion event is recorded. At this time, the text display state is "design". It can be determined that the text deletion event corresponding to the target deletion operation is the deletion "tool" event. The correspondence between the deletion "tool" event and the text display snapshot "designtool" corresponding to the triggering of the deletion operation "l" is added to the text event sequence. This allows the text display state to be directly switched from "design" to "design tool" by triggering an undo operation, improving the response efficiency of the undo operation.

[0076] S102: Determine the last text event in the text event sequence as the target text event.

[0077] In this embodiment of the disclosure, a text event from the most recently added text event sequence can be identified as the target text event. To facilitate understanding of the target text event in this embodiment, an example of a text event sequence corresponding to a number will be used for illustration.

[0078] In a scenario where a user changes "123" in a text box to "145" by deleting "23" and then entering "45", the user's first operation is to enter 1, 2, and 3, which together constitute the first text input event (123); the second operation is to delete 3 and 2, which together constitute the second text deletion event (32); and the third operation is to enter 4 and 5, which together constitute the third text input event (45). Correspondingly, this text event sequence includes the first text input event, the second text deletion event, and the third text input event arranged in chronological order. The most recently added text event in this sequence is the third text input event, which is then identified as the target text event.

[0079] S103: If it is determined that the target text event belongs to a text input event and the preceding text event of the target text event belongs to a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event of the target text event.

[0080] In practical applications, users can undo at least one text event in a text event sequence using the undo operation command+Z (Mac OS) or control+Z (Windows). In this embodiment, it is assumed that the text event sequence includes text input events, text deletion events, and a target text event arranged chronologically. The target text event is a text input event, and can be undone directly to the text display state before the text deletion event by triggering only one undo operation, improving the response efficiency of the undo operation and meeting the user's desired text display effect.

[0081] Continuing with the example mentioned above of changing "123" in a text box to "145" by deleting "23" and then entering "45", the text display snapshot corresponding to the second text deletion event in this text event sequence is the text display state when deletion operation 3 is about to be triggered, at which point the text display state is "123". By triggering an undo operation, the display can be directly reversed from "145" to "123", simplifying the user's operation complexity, improving the response efficiency of the undo operation, and meeting the user's expected text display effect.

[0082] This disclosure provides a text processing method, which includes: first, in response to an undo operation, acquiring a text event sequence; wherein the text event sequence includes at least one text event arranged in chronological order, each text event having a corresponding text display snapshot, the text display snapshot being used to record the text display state when the text event is triggered, the at least one text event including a text input event and a text deletion event, the text input event consisting of at least one consecutively triggered input operation, and the text deletion event consisting of at least one consecutively triggered deletion operation; determining the last text event in the text event sequence as the target text event; if the target text event is determined to be a text input event, and the preceding text event adjacent to the target text event is a text deletion event, then based on the text display snapshot corresponding to the preceding text event adjacent to the target text event, displaying the text corresponding to the undo operation. Therefore, in this disclosure, after a user deletes some text and re-enters new text, they can directly revert to the text display state before the text deletion by triggering only one undo operation, improving the response efficiency of the undo operation and meeting the user's desired text display effect.

[0083] To facilitate understanding of the text processing methods provided in the embodiments of this disclosure, in addition to the technology of the above embodiments, the embodiments of this disclosure also provide another text processing method.

[0084] In one optional implementation, if it is determined that the target text event belongs to a text input event, and the preceding text event adjacent to the target text event does not belong to a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event. Assuming the text event sequence includes text input events and the target text event arranged in chronological order, where the target text event is also a text input event, in response to the undo operation, the text is displayed based on the text display snapshot corresponding to the target text event. Clearly, in this embodiment, the target text event is treated as a whole, and by triggering only one undo operation, at least one consecutively triggered input operation within the target text event is skipped, and the switch is directly made between the target text event and the preceding text input event adjacent to the target text event. That is, without performing other operations, only one undo operation is triggered to directly undo the text display state before the target text event, simplifying user operation complexity, improving the response efficiency of the undo operation, and meeting the user's expected text display effect.

[0085] In another optional implementation, if it is determined that the target text event is a text deletion event, the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event. Assuming the text event sequence includes text input events and the target text event arranged in chronological order, where the target text event is a text deletion event, in response to the undo operation, the text is displayed based on the text display snapshot corresponding to the target text event. Clearly, in this embodiment, the target text event is treated as a whole, and by triggering only one undo operation, at least one consecutively triggered deletion operation within the target text event is quickly skipped. The switching occurs directly between the target text event and the preceding text input event. In other words, no other operations are required; by triggering only one undo operation, at least one consecutively triggered deletion operation within the deleted text is quickly skipped, directly switching from the text display state after deletion to the text display state before deletion. This simplifies user operation complexity, improves the response efficiency of the undo operation, and meets the user's desired text display effect.

[0086] To facilitate understanding of the text processing method provided in the embodiments of this disclosure, based on the above embodiments, at least one text event further includes a preset type text input event, wherein the preset type text input event consists of an input operation triggered between the call operations of a start callback function and an end callback function that have a corresponding relationship.

[0087] In this embodiment of the disclosure, a preset type text input event can be a text input event in which the time interval between adjacent input operations during text input is greater than a preset duration threshold. For example, in a preset type text input event, the time interval between the input of two adjacent characters is greater than 1 second. In practical applications, the time interval between the input of two adjacent characters in Chinese is greater than 1 second. Therefore, in this embodiment of the disclosure, the preset type text input event can be a text input event corresponding to Chinese characters.

[0088] In this embodiment of the disclosure, the callback function includes a start callback function and an end callback function. The start callback function corresponds to the input operation that triggers the start of a preset type text input event, and the end callback function corresponds to the input operation that triggers the end of a preset type text input event. The start callback function and the end callback function have a corresponding relationship, and the preset type text input event consists of the input operation triggered between the calls to the start callback function and the end callback function.

[0089] In one optional implementation, when a call to the start callback function is detected, a text display snapshot corresponding to the start callback function is obtained. This text display snapshot records the text display state corresponding to the input operation that triggers the start of a preset type text input event. Specifically, the text display state corresponding to the input operation that triggers the start of the preset type text input event can be determined by marking points. In practical applications, the text display state corresponding to the input operation that triggers the end of the preset type text input event can also be determined by marking points. When a call to the end callback function corresponding to the start callback function is detected, the input operations triggered between the calls to the start and end callback functions are added to the preset type text input event corresponding to the start callback function.

[0090] To illustrate the formation process of the preset type text input event provided in this embodiment, this embodiment provides a schematic diagram of the formation process of the preset type text input event, such as... Figure 4 As shown.

[0091] Assuming the text event sequence includes the input text event "123", and the preset type text input event is the Chinese text input event, in Chinese input method mode, when the input "g" is detected, the start callback function is triggered, and a text display snapshot corresponding to the start callback function is obtained. Specifically, the text display state corresponding to the triggering of the input "g" is recorded by dot notation. At this time, when "g" is input, the start dot notation is triggered, and the text display snapshot is "123". When the user inputs "gongju", the end callback function is triggered when the enter key is detected. Specifically, when the enter key is detected, the end dot notation is triggered, and the text display state after the end of the input for this preset type text input event is recorded, that is, the text display state of the preset type text input event at this time is "tool". The input "tool" triggered between the start and end callback function calls is added to the preset type text input event corresponding to the start callback function.

[0092] In practical applications, the correspondence between the preset type of text input event corresponding to the start callback function and the text display snapshot is added to the text event sequence. This allows the text to be displayed based on the text display snapshot corresponding to the start callback function by triggering an undo operation. In other words, the preset type of text input event is skipped, and the text display state before the preset type of text input event is undone. This simplifies the complexity of user operations, improves the response efficiency of the undo operation, and meets the user's expected text display effect.

[0093] For example, after the callback function call ends, the text event sequence includes the input text event "123" and the preset type text input event "tool". By triggering an undo operation, the operation of deleting "tool" and "tool" in sequence can be skipped, and the text display state can be directly switched from "123 tool" to "123". This simplifies the complexity of user operation, improves the response efficiency of the undo operation, and meets the user's expected text display effect.

[0094] In one optional implementation, if it is determined that the target text event belongs to a preset type of text input event, and the preceding text event is a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event. Assuming the text event sequence includes text input events, text deletion events, and the target text event arranged chronologically, where the target text event is a preset type of text input event, after a user deletes some text and re-enters preset type text, they can directly revert to the text display state before the text deletion by triggering only one undo operation. This improves the response efficiency of the undo operation and meets the user's desired text display effect.

[0095] Suppose the above text event sequence includes a third text input event, a fourth text deletion event, and a fifth preset type text input event arranged chronologically. The third text input event includes consecutively triggered inputs of "good idea," the fourth text deletion event includes consecutively triggered deletions of "a, e, d, i," and the fifth preset type text input event includes input of "tool" triggered between the start and end callback function calls. By triggering an undo operation, the text displayed can be based on the text prior to the fourth text deletion event. In this process, the consecutive deletions of "a, e, d, i" included in the fourth text deletion event are skipped, and the "good tool" is directly undone to "good idea," improving the response efficiency of the undo operation and meeting the user's desired text display effect.

[0096] In another optional implementation, if it is determined that the target text event belongs to a preset type of text input event, and the preceding text event adjacent to the target text event does not belong to a text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event. Assuming the text event sequence includes text input events and the target text event arranged in chronological order, where the target text event is a preset type of text input event, in response to the undo operation, the text is displayed based on the text display snapshot corresponding to the target text event. Clearly, in this embodiment, the target text event is treated as a whole. Only one undo operation is triggered, skipping the input operations triggered between the start and end callback function calls included in the target text event. The switch is directly performed between the target text event and the preceding text input event adjacent to the target text event. In other words, no other operations are required; only one undo operation is triggered to directly revert to the text display state before the target text event, simplifying user operation complexity, improving the response efficiency of the undo operation, and meeting the user's expected text display effect.

[0097] Assuming the above text event sequence includes a third text input event and a fourth preset type text input event arranged chronologically, where the third text input event includes the continuously triggered input operation "good idea," and the fourth preset type text input event includes the input "tool" triggered between the call to the start and end callback functions, a single undo operation is triggered to display the text based on the previous text display state "good idea." During this undo process, the target text event (the continuously triggered input operation "tool") is treated as a whole, requiring no other operations. A single undo operation allows for quick switching between "good idea tool" and "good idea," simplifying user operation complexity, improving the response efficiency of the undo operation, and meeting the user's desired text display effect.

[0098] Based on any of the above embodiments, the text corresponding to any of the above undo operations can be redone.

[0099] In one optional implementation, before displaying the text corresponding to the undo operation, the method further includes: obtaining a text display snapshot corresponding to the undo operation, the text display snapshot corresponding to the undo operation being used to record the text display state when the undo operation is triggered; and in response to a redo operation corresponding to the undo operation, displaying the text corresponding to the redo operation based on the text display snapshot corresponding to the undo operation.

[0100] In this embodiment of the disclosure, the redo operation corresponds to the undo operation of any text event in the text event sequence. In response to the redo operation, the text corresponding to the redo operation can be quickly displayed based on the text display snapshot corresponding to the undo operation, thereby improving text processing efficiency and meeting the user's expected text display effect.

[0101] In practical applications, the text display states corresponding to undo and redo operations are mirror images of each other. The text displayed for a redo operation is the text displayed in the text display snapshot corresponding to the undo operation; that is, the text display state corresponding to a redo operation is the text display state before the undo operation. Assuming the text event sequence includes text input events "design" and "tool" arranged chronologically, if an undo operation is performed, the text display snapshot corresponding to the undo operation is "design tool". Then, if a redo operation is performed, in response to the redo operation, the text is displayed based on the text display snapshot "design tool" corresponding to the undo operation. In other words, the text displayed for the redo operation, "design tool", is the text display snapshot "design tool" corresponding to the undo operation.

[0102] This disclosure provides a text processing method. First, when a call to a start callback function is detected, a text display snapshot corresponding to the start callback function is obtained. When a call to an end callback function corresponding to the start callback function is detected, the input operations triggered between the calls to the start and end callback functions are added to a preset type text input event corresponding to the start callback function. The correspondence between the preset type text input event corresponding to the start callback function and the text display snapshot is added to a text event sequence. Therefore, in this disclosure, after a user deletes some text and re-enters new preset type text, they can directly revert to the text display state before the text was deleted by triggering only one undo operation, improving the response efficiency of the undo operation and meeting the user's desired text display effect.

[0103] Based on the same inventive concept as the above embodiments, this disclosure also provides a text processing device, with reference to... Figure 5 This is a schematic diagram of the structure of a text processing device provided in an embodiment of the present disclosure. The device includes:

[0104] The first acquisition module 501 is used to acquire a text event sequence in response to an undo operation; wherein the text event sequence includes at least one text event arranged in chronological order, each text event has a corresponding text display snapshot, the text display snapshot is used to record the text display state when the text event is triggered, at least one text event includes a text input event and a text deletion event, the text input event consists of at least one input operation triggered consecutively, the text deletion event consists of at least one deletion operation triggered consecutively, and the next operation adjacent to the last deletion operation triggered in at least one deletion operation is an input operation;

[0105] The first determining module 502 is used to determine the last text event in the text event sequence as the target text event;

[0106] The first display module 503 is used to display the text corresponding to the undo operation based on the text display snapshot corresponding to the adjacent preceding text event when it is determined that the target text event belongs to a text input event and the adjacent preceding text event of the target text event belongs to a text deletion event.

[0107] In one optional embodiment, the device further includes:

[0108] The second display module is used to display the text corresponding to the undo operation based on the text display snapshot corresponding to the target text event when it is determined that the target text event belongs to the text input event and the adjacent preceding text event of the target text event does not belong to the text deletion event.

[0109] In one optional embodiment, the device further includes:

[0110] The third display module is used to display the text corresponding to the undo operation based on the text display snapshot corresponding to the target text event when it is determined that the target text event is a text deletion event.

[0111] In one optional implementation, the triggering time interval between adjacent input operations in at least one input operation of a text input event is not greater than a preset duration threshold.

[0112] In one optional embodiment, the device further includes:

[0113] The first detection module is used to obtain a text display snapshot corresponding to the target input operation when the target input operation is detected, and start timing to determine whether there is an input operation within a preset time threshold.

[0114] The second determining module is used to reset the timer and start timing again when it is determined that there is an input operation within the preset time threshold, and add the input operation to the text input event corresponding to the target input operation, and continue to determine whether there is an input operation within the preset time threshold until it is determined that there is no input operation within the preset time threshold.

[0115] The first module is used to obtain the text input event corresponding to the target input operation and add the correspondence between the text input event and the text display snapshot to the text event sequence.

[0116] In one optional embodiment, the device further includes:

[0117] The second detection module is used to obtain a text display snapshot corresponding to the target deletion operation when the target deletion operation is detected, and to determine whether the next adjacent operation is a deletion operation.

[0118] The third determination module is used to add the next adjacent operation to the text deletion event corresponding to the target deletion operation when it is determined that the next adjacent operation is a deletion operation, and continue to determine whether the next adjacent operation is a deletion operation until it is determined that the next adjacent operation is not a deletion operation.

[0119] The second module is used to obtain the text deletion event corresponding to the target deletion operation and add the correspondence between the text deletion event and the text display snapshot to the text event sequence.

[0120] In one optional implementation, at least one text event further includes a preset type text input event, which consists of an input operation triggered between calls to a corresponding start callback function and an end callback function.

[0121] In one optional embodiment, the device further includes:

[0122] The third detection module is used to obtain a snapshot of the text display corresponding to the start callback function when a call to the start callback function is detected.

[0123] The third addition module is used to add the input operations triggered between the calls to the start callback function and the end callback function to the preset type text input event corresponding to the start callback function when a call to the end callback function is detected.

[0124] The fourth module is used to add the correspondence between the preset type of text input event corresponding to the start callback function and the text display snapshot to the text event sequence.

[0125] In one optional embodiment, the device further includes:

[0126] The fourth display module is used to display the text corresponding to the undo operation based on the text display snapshot corresponding to the preceding text event when it is determined that the target text event belongs to a preset type of text input event and the preceding text event of the target text event belongs to a text deletion event.

[0127] In one optional embodiment, the device further includes:

[0128] The fifth display module is used to display the text corresponding to the undo operation based on the text display snapshot corresponding to the target text event when it is determined that the target text event belongs to a preset type of text input event and the preceding text event adjacent to the target text event does not belong to a text deletion event.

[0129] In one optional embodiment, the device further includes:

[0130] The second acquisition module is used to acquire a snapshot of the text display corresponding to the undo operation;

[0131] The sixth display module is used to respond to the redo operation corresponding to the undo operation, display a snapshot of the text corresponding to the undo operation, and display the text corresponding to the redo operation.

[0132] This disclosure provides a text processing apparatus, comprising: first, in response to an undo operation, acquiring a text event sequence; wherein the text event sequence includes at least one text event arranged in chronological order, each text event having a corresponding text display snapshot, the text display snapshot being used to record the text display state when the text event is triggered, the at least one text event including a text input event and a text deletion event, the text input event consisting of at least one consecutively triggered input operation, and the text deletion event consisting of at least one consecutively triggered deletion operation; determining the last text event in the text event sequence as the target text event; if the target text event is determined to be a text input event, and the preceding text event adjacent to the target text event is a text deletion event, then based on the text display snapshot corresponding to the preceding text event adjacent to the target text event, displaying the text corresponding to the undo operation. Therefore, in this disclosure, after a user deletes some text and re-enters new text, they can directly revert to the text display state before the text deletion by triggering only one undo operation, improving the response efficiency of the undo operation and meeting the user's desired text display effect.

[0133] In addition to the methods and apparatus described above, this disclosure also provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to implement the text processing method provided in this disclosure.

[0134] This disclosure also provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, they implement the text processing method provided in this disclosure.

[0135] In addition, this disclosure also provides a text processing device, see [link to relevant documentation]. Figure 6 As shown, it may include:

[0136] The device includes a processor 601, a memory 602, an input device 603, and an output device 604. The number of processors 601 in the live streaming room's page display device can be one or more. Figure 6 Taking a processor as an example. In some embodiments of this disclosure, the processor 601, memory 602, input device 603, and output device 604 can be connected via a bus or other means, wherein, Figure 6 Taking the example of a connection between China and Israel via a bus.

[0137] The memory 602 can be used to store software programs and modules. The processor 601 runs the software programs and modules stored in the memory 602 to perform various functional applications and data processing of the text processing device. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The input device 603 can be used to receive input digital or character information, and to generate signal inputs related to user settings and function control of the text processing device.

[0138] Specifically in this embodiment, the processor 601 loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602, thereby realizing the various functions of the above-mentioned text processing device.

[0139] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0140] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A text processing method, characterized in that, The method includes: In response to an undo operation, a text event sequence is acquired; wherein the text event sequence includes at least one text event arranged in chronological order, each text event having a corresponding text display snapshot, the text display snapshot being used to record the text display state when the text event is triggered, the at least one text event including a text input event and a text deletion event, the text input event consisting of at least one consecutively triggered input operation, the text deletion event consisting of at least one consecutively triggered deletion operation, the next operation adjacent to the last triggered deletion operation in the at least one deletion operation being an input operation; the text input event including a preset type text input event, the preset type text input event consisting of an input operation between a start input operation and an end input operation, the start input operation being used to trigger the start of the preset type text input event, the end input operation being used to trigger the end of the preset type text input event; The last text event in the text event sequence is identified as the target text event; If it is determined that the target text event belongs to the text input event, and the preceding text event of the target text event belongs to the text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event of the target text event.

2. The method according to claim 1, characterized in that, The method further includes: If it is determined that the target text event belongs to the text input event, and the preceding text event adjacent to the target text event does not belong to the text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event.

3. The method according to claim 1, characterized in that, The method further includes: If it is determined that the target text event belongs to the text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event.

4. The method according to any one of claims 1-3, characterized in that, The triggering time interval between adjacent input operations in the text input event is no greater than a preset duration threshold.

5. The method according to claim 4, characterized in that, The method further includes: When a target input operation is detected, a text display snapshot corresponding to the target input operation is obtained, and a timer is started to determine whether an input operation exists within the preset time threshold. If it is determined that an input operation exists within the preset duration threshold, the timer is reset and restarted, and the input operation is added to the text input event corresponding to the target input operation. The process of determining whether an input operation exists within the preset duration threshold continues until it is determined that no input operation exists within the preset duration threshold. Obtain the text input event corresponding to the target input operation, and add the correspondence between the text input event and the text display snapshot to the text event sequence.

6. The method according to any one of claims 1-3, characterized in that, The method further includes: When a target deletion operation is detected, a text display snapshot corresponding to the target deletion operation is obtained, and it is determined whether the next adjacent operation is a deletion operation. If it is determined that the next adjacent operation is a deletion operation, then the next adjacent operation is added to the text deletion event corresponding to the target deletion operation, and the process of determining whether the next adjacent operation is a deletion operation continues until it is determined that the next adjacent operation is not a deletion operation. Obtain the text deletion event corresponding to the target deletion operation, and add the correspondence between the text deletion event and the text display snapshot to the text event sequence.

7. The method according to any one of claims 1-3, characterized in that, The preset type text input event consists of input operations triggered between calls to start and end callback functions that have a corresponding relationship.

8. The method according to claim 7, characterized in that, The method further includes: When a call to the start callback function is detected, a snapshot of the text display corresponding to the start callback function is obtained; When a call to the end callback function corresponding to the start callback function is detected, the input operations triggered between the call to the start callback function and the end callback function are added to the preset type text input event corresponding to the start callback function. The correspondence between the preset type of text input event corresponding to the start callback function and the text display snapshot is added to the text event sequence.

9. The method according to claim 7, characterized in that, The method further includes: If it is determined that the target text event belongs to the preset type of text input event, and the preceding text event of the target text event belongs to the text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the preceding text event of the target text event.

10. The method according to claim 9, characterized in that, The method further includes: If it is determined that the target text event belongs to the preset type of text input event, and the preceding text event adjacent to the target text event does not belong to the text deletion event, then the text corresponding to the undo operation is displayed based on the text display snapshot corresponding to the target text event.

11. The method according to any one of claims 1-3, characterized in that, Before displaying the text corresponding to the undo operation, the method further includes: Obtain a snapshot of the text display corresponding to the undo operation; In response to the redo operation corresponding to the undo operation, the text corresponding to the redo operation is displayed based on the text display snapshot corresponding to the undo operation.

12. A text processing device, characterized in that, The device includes: The first acquisition module is used to acquire a text event sequence in response to an undo operation; wherein the text event sequence includes at least one text event arranged in chronological order, each text event has a corresponding text display snapshot, the text display snapshot is used to record the text display state when the text event is triggered, the at least one text event includes a text input event and a text deletion event, the text input event consists of at least one consecutively triggered input operation, the text deletion event consists of at least one consecutively triggered deletion operation, and the next operation adjacent to the last triggered deletion operation in the at least one deletion operation is an input operation; the text input event includes a preset type text input event, the preset type text input event consists of an input operation between a start input operation and an end input operation, the start input operation is used to trigger the start of the preset type text input event, and the end input operation is used to trigger the end of the preset type text input event; The first determining module is used to determine the last text event in the text event sequence as the target text event; The first display module is configured to, when it is determined that the target text event belongs to the text input event and the preceding text event of the target text event belongs to the text deletion event, display the text corresponding to the undo operation based on the text display snapshot corresponding to the preceding text event of the target text event.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the method as described in any one of claims 1-11.

14. A text processing device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1-11.

15. A computer program product, characterized in that, The computer program product includes a computer program / instruction that, when executed by a processor, implements the method as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Input method based data processing method and device

    CN104571589A