Cursor display method, device and equipment of collaborative document and storage medium

By receiving the collaborator's cursor position and data offset information, the correct display position of the collaborator's cursor on the current client user interface is calculated, which solves the problem of cursor flickering in collaborative documents and improves the efficiency and user experience of collaborative documents.

CN116991279BActive Publication Date: 2026-11-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211338644.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-28
Publication Date
2026-11-20
Estimated Expiration
2042-10-28

AI Technical Summary

Technical Problem

In collaborative documents, cursor position switching conflicts caused by network transmission delays can cause the cursor position of collaborators to flicker on the user interface, affecting the efficiency of using collaborative documents.

Method used

By receiving the collaborator's cursor position and data offset information, the correct display position of the collaborator's cursor on the current client user interface is calculated. The data offset information is used to eliminate cursor position flickering, and a cursor position backtracking and version number mechanism is adopted to ensure the consistency of the cursor position.

Benefits of technology

It avoids cursor blinking, improves the efficiency of using collaborative documents, optimizes the cursor experience in collaborative scenarios, reduces resource consumption, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116991279B_ABST
    Figure CN116991279B_ABST
Patent Text Reader

Abstract

The application discloses a cursor display method and device of a collaborative document, equipment and a storage medium, and relates to the technical field of Internet. The method comprises the following steps: receiving a first collaborator cursor message, wherein the first collaborator cursor message is used for indicating a first cursor position of a second account, and the second account and the first account are both collaborator accounts of the collaborative document; determining a second cursor position according to the first cursor position and data offset information, wherein the data offset information is used for indicating the character offset between the local data content of the first client and the data content of the collaborative document corresponding to the version of the first collaborator cursor message; and displaying the cursor of the second account at the second cursor position. The application provides a method for correctly displaying the cursor position of a collaborator in a collaborative document, avoids the cursor flickering caused by the incorrect cursor position of the collaborator, and improves the efficiency of the collaborative document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, device and storage medium for displaying a cursor in collaborative documents. Background Technology

[0002] A collaborative document is a document that can be edited collaboratively by multiple people in real time. This means that multiple users can edit the same document at the same time, and each user's edits will be synchronized to the clients of all collaborators.

[0003] During collaborative editing of a document, each user's cursor position is sent to all collaborators' clients, ensuring that the user's editing position and content are visible to others, facilitating collaboration. However, due to network latency and other factors, cursor position changes can conflict with data changes made by other collaborators. In related technologies, if client A changes its cursor position while client B changes its data, client A broadcasts its current cursor position to all participating clients before receiving the data change from client B. After receiving the data change from client B, client A first updates its local data accordingly and then broadcasts its current cursor position again, achieving a unified cursor position for all collaborative work.

[0004] However, before and after client A updates the data from client B locally, it sends the cursor position to client B once each. The difference between the two cursor positions causes flickering on client B's user interface, affecting the efficiency of using collaborative documents. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for displaying cursors in collaborative documents. It provides a method for correctly displaying the cursors of collaborators in collaborative documents, avoiding errors in the cursor position. The technical solution is as follows:

[0006] According to one aspect of this application, a cursor display method for collaborative documents is provided, the method being executed by a first client logged into a first account, the method comprising:

[0007] Receive a first collaborator cursor message, which is used to indicate the first cursor position of the second account. Both the second account and the first account are collaborator accounts of the collaborative document.

[0008] The second cursor position is determined based on the first cursor position and the data offset information, wherein the data offset information is used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the first collaborator cursor message;

[0009] Display the cursor of the second account at the second cursor position.

[0010] According to another aspect of this application, a cursor display method for a collaborative document is provided, the method being executed by a first client logged into a first account and a second client logged into a second account, wherein both the second account and the first account are collaborator accounts of the collaborative document, the method comprising:

[0011] The first client and the second client display the cursor of the second account in the first version of the collaborative document;

[0012] The first client receives a first data editing operation before the cursor position of the second account; in response to the first data editing operation, it displays a change to the document content of the collaborative document from the first version to the second version;

[0013] The second client receives a first cursor position change operation before the collaborative document is changed to the second version; in response to the first cursor position change operation, the second account's cursor is changed to the first cursor position in the first version of the collaborative document;

[0014] The first client displays the cursor of the second account in the second version of the collaborative document, which is changed to the second cursor position. The first cursor position and the second cursor position indicate the same input position in both versions of the collaborative document.

[0015] According to another aspect of this application, a cursor display device for collaborative documents is provided, the device being logged into a first account, the device comprising:

[0016] The receiving module is used to receive a first collaborator cursor message, which is used to indicate the first cursor position of the second account. Both the second account and the first account are collaborator accounts of the collaborative document.

[0017] The determination module is used to determine the second cursor position based on the first cursor position and data offset information, wherein the data offset information is used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the first collaborator cursor message;

[0018] The display module is used to display the cursor of the second account at the second cursor position.

[0019] According to another aspect of this application, a cursor display device for collaborative documents is provided. The device includes a first sub-device logged into a first account and a second sub-device logged into a second account, wherein both the second account and the first account are collaborator accounts for the collaborative document. The device includes:

[0020] The display module of the first sub-device is used to display the cursor of the second account in the first version of the collaborative document; the display module of the second sub-device is used to display the cursor of the second account in the first version of the collaborative document.

[0021] The receiving module of the first sub-device is used to receive a first data editing operation before the cursor position of the second account; the display module of the first sub-device is used to display, in response to the first data editing operation, that the document content of the collaborative document has been changed from the first version to the second version.

[0022] The receiving module of the second sub-device is used to receive the first cursor position change operation before the collaborative document is changed to the second version; the display module of the second sub-device is used to display in the first version of the collaborative document, in response to the first cursor position change operation, that the cursor of the second account is changed to the first cursor position;

[0023] The display module of the first sub-device is used to display in the second version of the collaborative document that the cursor of the second account has been changed to a second cursor position, and the first cursor position and the second cursor position indicate the same input position in both versions of the collaborative document.

[0024] According to another aspect of this application, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the cursor display method for collaborative documents as described above.

[0025] According to another aspect of this application, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the cursor display method for collaborative documents as described above.

[0026] According to another aspect of this application, a computer program product is provided, which stores at least one instruction, at least one program segment, code set, or instruction set, wherein the at least one instruction, the at least one program segment, the code set, or instruction set is loaded and executed by the processor to implement the cursor display method for collaborative documents as described above.

[0027] The beneficial effects of the technical solutions provided in this application include at least the following:

[0028] By receiving the collaborator's cursor position and data offset information, the position of the collaborator's cursor is determined. The data offset information indicates the character offset between the local data content of the current client and the data content of the collaborative file version corresponding to the received cursor information. This is used to correctly calculate the position where the collaborator's cursor should be displayed on the current client's user interface, avoiding cursor flickering caused by incorrect calculation of the collaborator's cursor position and improving the efficiency of using collaborative documents. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a schematic diagram of the cursor display interface in the collaborative document in the related technology of this application;

[0031] Figure 2 This is a schematic diagram of the cursor display interface for a collaborative document provided in an exemplary embodiment of this application;

[0032] Figure 3 This is a structural block diagram of a computer system provided in an exemplary embodiment of this application;

[0033] Figure 4 This is a flowchart of a cursor display method for collaborative documents provided in an exemplary embodiment of this application;

[0034] Figure 5 This is a flowchart of a cursor display method for collaborative documents provided in an exemplary embodiment of this application;

[0035] Figure 6 This is a flowchart of a cursor display method for collaborative documents provided in an exemplary embodiment of this application;

[0036] Figure 7 This is a flowchart of a cursor display method for collaborative documents provided in an exemplary embodiment of this application;

[0037] Figure 8 This is a structural block diagram of a cursor display device for collaborative documents provided in an exemplary embodiment of this application;

[0038] Figure 9 This is a structural block diagram of a cursor display device for collaborative documents provided in an exemplary embodiment of this application;

[0039] Figure 10This is a block diagram of a terminal provided in an exemplary embodiment of this application. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0041] First, the terminology used in the embodiments of this application will be introduced:

[0042] Cursor position conflict: This occurs when a user's data changes in a collaborative document conflict with cursor messages sent by other collaborators. For example, consider two users, A and B, working on a collaborative document. User A enters "123" at the beginning of the document, while user B moves their cursor to position e. When user B sends their current cursor position, they haven't yet received user A's data change (e.g., due to network latency). Therefore, user B's cursor message (i.e., cursor position e) will conflict with user A's actual data change. In reality, user B's cursor message should be displayed at position e+3 on user A.

[0043] Local queue: Used to cache data changes made by users that have not yet been submitted to the server or confirmed by the server. In a collaborative document, data changes made by users are first stored in the local queue, then submitted at the network layer, and finally sent to the server; after the server confirms, the corresponding data in the local queue is destroyed.

[0044] Cursor position backtracking: This involves a user retrieving the cursor position corresponding to the current collaborative document version (i.e., the cursor position when the local queue is empty) by removing cached data changes from the current cursor position in the local queue. For example, in a collaborative document, user A experiences a network outage due to network fluctuations and remains at data version 100. After switching the cursor to position f to add the content "123", user A's cursor moves to position f+3. Once the network is restored, directly synchronizing user A's current cursor position f+3 and the corresponding data version 100 would not correspond to user A's actual cursor position and data version. Therefore, cursor position backtracking is necessary to report data version 100, the cursor position f, and data changes after data version 100.

[0045] Version number: Used to identify different versions of collaborative documents. After receiving data changes, the client submits the changes to the server. A new version is generated after server confirmation (i.e., after the data is written to disk). That is, data changes do not have version numbers in the local queue; they only acquire a version number after the data is written to disk.

[0046] Update mechanism for collaborative documents: In collaborative documents, data changes and cursor positions are updated separately through different messages.

[0047] Offset: In this article, forward offset refers to adding the character offset indicated in the data offset information to the base cursor position; reverse offset refers to subtracting the character offset indicated in the data offset information from the base cursor position.

[0048] Figure 1 The diagram illustrates the user interface of user A when user A and user B are simultaneously editing a collaborative document, according to related technologies. User interface 41 includes cursor 31 for user A and cursor 32 for user B. Cursor 31 for user A is positioned before the character "1," and cursor 32 for user B is positioned after the character "9." Next, user A plans to insert the character "-" before the character "1," and user B plans to move cursor 32 to after the character "4." After inserting the "-," cursor 31 for user A moves to the middle between the "-" and the character "1." Since user B's client has not received the changes made by user A to the collaborative document, it sends a cursor position between the fourth and fifth characters to user A's client, which is the cursor 32 displayed in user interface 42 between the characters "3" and "4." Finally, after user B's client receives the changes made by user A, it resends user B's cursor position to user A's client based on the revised collaborative document. This is user B's cursor 32 displayed in user interface 43, located after the character "4".

[0049] pass Figure 1 As shown in the diagram, in user A's user interface 42 and user interface 43, user B's cursor 32 has a different cursor position. This causes the cursor to flicker visually, resulting in low efficiency in using collaborative documents. Especially when there are many collaborators in a collaborative document, the constant flickering of each collaborator's cursor greatly reduces the efficiency and effectiveness of collaborative editing.

[0050] Figure 2The diagram illustrates the user interface of user A when user A and user B are simultaneously editing a collaborative document, according to the cursor display method of this application. User interface 44 includes cursor 31 for user A and cursor 32 for user B. Cursor 31 for user A is positioned before the character "1," and cursor 32 for user B is positioned after the character "9." Next, user A plans to insert the character "-" before the character "1," and user B plans to move cursor 32 to the position after the character "4." In user interface 45, after inserting the character "-," cursor 31 for user A moves to the middle between the character "-" and the character "1," and cursor 32 for user B appears after the character "4." That is, both cursor 31 for user A and cursor 32 for user B can be moved to the correct position in one go, without cursor flickering, and the cursor positions of each user remain consistent across all collaborators' user interfaces, greatly improving the efficiency of using collaborative documents.

[0051] Figure 3 A structural block diagram of a computer system provided in an exemplary embodiment of this application is given. The computer system 100 includes: a first terminal 110, a server 120, and a second terminal 130.

[0052] The first terminal 110 has a first client 111 installed and running, which supports collaborative document editing. The first client 111 can be an application or a web client with collaborative document editing capabilities. When the first terminal 110 runs the first client 111, the user interface of the first client 111 is displayed on the screen of the first terminal 110. This application can be any one of an instant messaging program, office application, online community program, payment program, shopping program, dating program, or marriage application. In this embodiment, a collaborative document editing program is used as an example. The first terminal 110 is the terminal used by the first user 112, and the first account of the first user 112 is logged into the first client 111.

[0053] The second terminal 130 has a second client 131 installed and running, which supports collaborative document editing. The second client 131 can be an application or a web client with collaborative document editing capabilities. When the second terminal 130 runs the second client 131, the user interface of the second client 131 is displayed on the screen of the second terminal 130. This application can be any one of an instant messaging program, office application, online community program, payment program, shopping program, dating program, or marriage application. In this embodiment, a collaborative document editing program is used as an example. The second terminal 130 is the terminal used by the second user 132, and the second account of the second user 132 is logged into the second client 131.

[0054] Optionally, the first user and the second user can be in the same collaborative document. Optionally, the first user and the second user can belong to the same team, the same organization, the same lobby, the same channel, have a friend relationship, have temporary editing permissions, or enter the collaborative document through the same link.

[0055] Optionally, the applications installed on the first terminal 110 and the second terminal 130 are the same, or the applications installed on the two terminals are the same type of application on different operating system platforms (Android or iOS). The first terminal 110 can refer to one of multiple terminals, and the second terminal 130 can refer to another of multiple terminals; this embodiment only uses the first terminal 110 and the second terminal 130 as examples. The device types of the first terminal 110 and the second terminal 130 may be the same or different, and these device types include at least one of the following: smartphones, tablets, e-book readers, MP3 players, MP4 players, laptops, and desktop computers.

[0056] Figure 3 Only two terminals are shown in the diagram, but in different embodiments, multiple other terminals 140 can access the server 120. Optionally, one or more terminals 140 may also be terminals corresponding to developers, with a development and editing platform for a client that supports collaborative document editing installed on the terminal 140. Developers can edit and update the client on the terminal 140 and transmit the updated application installation package to the server 120 via wired or wireless network. The first terminal 110 and the second terminal 130 can download the application installation package from the server 120 to update the client.

[0057] The first terminal 110, the second terminal 130, and other terminals 140 are connected to the server 120 via a wireless network or a wired network.

[0058] Server 120 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Server 120 provides background services for clients that support collaborative document editing. Optionally, server 120 undertakes the primary computing task, and the terminal undertakes the secondary computing task; or, server 120 undertakes the secondary computing task, and the terminal undertakes the primary computing task; or, server 120 and the terminal use a distributed computing architecture for collaborative computing.

[0059] In an illustrative example, server 120 includes processor 122, user account database 123, collaborative document editing module 124, and user-facing input / output interface (I / O interface) 125. Processor 122 loads instructions stored in server 121 and processes data in user account database 123 and collaborative document editing module 124. User account database 123 stores user account data used by first terminal 110, second terminal 130, and other terminals 140, such as user account avatars, nicknames, and group memberships. Collaborative document editing module 124 provides users with the ability to view and edit collaborative documents. User-facing I / O interface 125 establishes communication and data exchange with first terminal 110 and / or second terminal 130 via wireless or wired network.

[0060] Based on the above description of the implementation environment, the cursor display method for collaborative documents provided in this application embodiment will be described, taking the execution subject of the method as... Figure 3 The example shown illustrates a client running on a terminal. This terminal runs a client application that supports collaborative document editing.

[0061] Figure 4 A flowchart illustrating a cursor display method for collaborative documents according to an exemplary embodiment of this application is shown. This embodiment uses this method... Figure 3 The example shown illustrates the execution of a first client and a second client, where the first client is logged into a first account and the second client is logged into a second account. The method includes:

[0062] Step 220: Receive the cursor message from the first collaborator;

[0063] For example, the first client receives a first collaborator cursor message sent by the second client.

[0064] For example, the first collaborator cursor message is used to indicate the first cursor position of the second account; wherein, both the second account and the first account are collaborator accounts of the collaborative document.

[0065] For example, the first cursor position is the cursor position of the second account corresponding to the current collaborative document version of the second client.

[0066] Optionally, if the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client are different, the first collaborator cursor message is stored in the cursor message cache pool; then, the step 240 described in step 240, which determines the second cursor position based on the first cursor position and data offset information, is executed.

[0067] Optionally, the cursor message cache pool includes a low-version cursor message cache pool and a high-version cursor message cache pool. If the first version is lower than the second version, the first collaborator cursor message is stored in the low-version cursor message cache pool; if the first version is higher than the second version, the first collaborator cursor message is stored in the high-version cursor message cache pool.

[0068] That is, when the first version is equal to the second version, the versions of the collaborative documents corresponding to the first client and the second client are the same. In this case, the cursor message of the first collaborator can be sent to the business layer for cursor rendering or other operations. However, when the first version and the second version are different, the data content of the collaborative documents corresponding to the first client and the second client are also different. In this case, the cursor message of the first collaborator should be cached in the cursor message cache pool first.

[0069] Optionally, if the first version is greater than the second version, that is, the collaborative document version corresponding to the second client is greater than the collaborative document version corresponding to the first client, the collaborative document version corresponding to the first client should be updated first; if the first version is less than the second version, that is, the collaborative document version corresponding to the first client is greater than the collaborative document version corresponding to the second client, the first cursor position indicated by the first collaborator's cursor message should be offset based on the data changes between the second and first versions to obtain a cursor position suitable for the second version.

[0070] Step 240: Determine the position of the second cursor based on the first cursor position and the data offset information;

[0071] For example, data offset information is used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the cursor message of the first collaborator.

[0072] For example, the data offset information includes at least one first data offset information, which is used to indicate the character offset between the first version corresponding to the collaborator cursor message and the second version corresponding to the first client.

[0073] For example, if the first version corresponding to the first collaborator's cursor message is less than the second version corresponding to the first client, the first cursor position is shifted forward according to the first data offset information to obtain the second cursor position.

[0074] For example, the data offset information includes second data offset information, which is used to indicate the character offset in the local queue of the first client. The local queue is used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes.

[0075] For example, the second cursor position is obtained by positively offsetting the first cursor position according to the second data offset information.

[0076] Among them, forward offset means adding the character offset from the data offset information to the first cursor position; reverse offset means subtracting the character offset from the data offset information from the first cursor position.

[0077] It should be noted that the data offset information may include only the first data offset information mentioned above; or, the data offset information may include only the second data offset information; or, the data offset information may include both the first data offset information and the second data offset information.

[0078] Step 260: Display the cursor of the second account at the second cursor position.

[0079] For example, on the user interface of the first client, the cursor of the second account is displayed at the second cursor position.

[0080] Optionally, the user interface of the first client is an interface displayed on the first client for viewing or editing collaborative documents.

[0081] Optionally, the user interface of the first client may include text messages, image messages, video messages, audio messages, symbol messages, etc. The user interface of the first client may also include insert controls, font selection controls, bold controls, italic controls, etc.

[0082] Optionally, the cursor of the second account may be the same as or different from the cursor of the first account; the cursor of the second account may be fixed or jumping. This application does not limit the appearance of the cursor of the second account.

[0083] Optionally, if the cursor position of the first account is changed, the first account needs to broadcast the changed cursor message to other collaborators.

[0084] For example, the first client receives a cursor position change operation, which is used to change the cursor position of the first account to a third cursor position; based on the third cursor position and third data offset information, a fourth cursor position is determined, wherein the third data offset information is used to indicate the character offset in the local queue of the first client, and the local queue is used to cache data changes that have not yet been confirmed by the server and the character offset corresponding to the data changes; the first client sends a second collaborator cursor message to collaborator accounts other than the first account, which is used to indicate the fourth cursor position corresponding to the first account.

[0085] In summary, the method provided in this application calculates the position of the collaborator's cursor based on the received first cursor position and data offset information. By using the data offset information to eliminate the character offset between the local data content of the current client and the data content of the collaborative file version corresponding to the received cursor information, the method correctly calculates the position where the collaborator's cursor should be displayed on the current client's user interface, avoiding cursor flickering caused by incorrect calculation of the collaborator's cursor position and improving the efficiency of using collaborative documents.

[0086] Figure 5 A flowchart illustrating a cursor display method for collaborative documents according to an exemplary embodiment of this application is shown. This embodiment uses this method... Figure 3 The example shown illustrates the execution of a first client and a second client, where the first client is logged into a first account and the second client is logged into a second account. The method includes:

[0087] Step 320: Receive the cursor message from the first collaborator;

[0088] For example, the first client receives a first collaborator cursor message sent by the second client.

[0089] For example, the first collaborator cursor message is used to indicate the first cursor position of the second account; wherein, both the second account and the first account are collaborator accounts of the collaborative document.

[0090] Optionally, the first cursor position indicated in the first collaborator's cursor message is the cursor position determined by the second client through cursor position backtracking. For example, after receiving a cursor position change operation from the second account, the second client subtracts the character offset cached in the second account's local queue from the changed cursor position of the second account to obtain the first cursor position; wherein, the cursor position change operation is used to change the cursor position of the second account.

[0091] Optionally, if the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client are different, the first collaborator cursor message is stored in the cursor message cache pool; then, the steps 342 and / or 344 below are executed to determine the second cursor position based on the first cursor position and data offset information.

[0092] Optionally, the cursor message cache pool includes a low-version cursor message cache pool and a high-version cursor message cache pool. If the first version is lower than the second version, the first collaborator cursor message is stored in the low-version cursor message cache pool; if the first version is higher than the second version, the first collaborator cursor message is stored in the high-version cursor message cache pool.

[0093] Optionally, if the first version is greater than the second version, the document version corresponding to the first client is updated; if the first version is equal to the updated second version, the cursor position of the second account is displayed based on the first cursor position; if the first version is less than the updated second version, the step of determining the second cursor position based on the first cursor position and data offset information is performed.

[0094] Optionally, if no offset corresponding to the first version exists, the interface for supplementing version data will be called. For example, the corresponding data will be supplemented for each version 50.

[0095] Step 342: If the first version corresponding to the first collaborator's cursor message is less than the second version corresponding to the first client, the first cursor position is shifted forward according to the first data offset information to obtain the second cursor position;

[0096] For example, the data offset information includes at least one first data offset information, which is used to indicate the character offset between the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client.

[0097] Optionally, before performing step 342, at least one of the following steps must also be performed: storing the first data offset based on data changes of other collaborator accounts besides the first account; storing the first data offset based on data changes successfully submitted to the server by the first account and confirmed by the server.

[0098] That is, in scenarios where the network is offline or in real-time scenarios, fetch data changes generated by collaborators' accounts other than the first account; or, store data changes submitted by the first account that have been confirmed by the server (data changes written to disk).

[0099] In other words, the main sources of the first offset storage are: data changes submitted by the first client and confirmed by the server (data edited and stored on disk by the first account); data changes generated by other collaborator accounts besides the first account (data edited and stored on disk by the collaborator of the first account); and data pulled from the version gap of the collaborative document (from the offline scenario, data will be pulled to fill in the gap where the data version is discontinuous).

[0100] Optionally, when storing the first data offset, to avoid excessive memory usage, a fixed window right-sliding strategy can be used to limit the window size. That is, the size of the memory window is fixed, and when the storage amount exceeds the length of memory, a portion of the content on the left side of the original window is discarded, and the window is continuously slid to the right to dynamically prevent memory overflow, and it continues to slide towards higher versions (i.e., data from older versions will be discarded).

[0101] Optionally, the size of the memory window can be selected as 1000, ensuring that the maximum version length of the repository is 1000. This application does not impose any limit on the size of the memory window.

[0102] For example, the first data offset information includes the first insertion point and the first data offset. For instance, if the current data version of the first client is 100, and the first account inserts the text "2" at cursor position 10, the data version becomes 101. Then, the first data offset can be stored as: [Version: 101, Insertion point: 10, Offset: +1].

[0103] Optionally, when a character is inserted at the first insertion point, the first data offset is a positive number; when a character is deleted at the first insertion point, the first data offset is a negative number.

[0104] Optionally, if a character is deleted at the first insertion point, and the first cursor position is within the range of characters to be deleted, then the cursor position after deletion should be at the beginning of the range of characters to be deleted.

[0105] For example, if the first version corresponding to the first collaborator's cursor message is less than the second version corresponding to the first client and the first cursor position is located after the first insertion point, the first cursor position is added to the first data offset to obtain the second cursor position.

[0106] For example, the data version of the first account is 102, and the data version corresponding to the first collaborator cursor message is 100. The first data offset includes the following two values: [Version: 101, Insertion Point: 10, Offset: +1] and [Version: 102, Insertion Point: 11, Offset: +1]. That is, during the version update process from data version 100 to data version 102, a character was inserted at position 10 and another character was inserted at position 11. If the first cursor position indicated by the first collaborator cursor message is 20, that is, after the first insertion point, it will be affected by the inserted data. Therefore, the first cursor position needs to be accumulated by the aforementioned first data offset. That is, the cursor position at 20 in data version 100 is 21 in data version 101 and 22 in data version 102, so the second cursor position is 22.

[0107] Step 344: After shifting the first cursor position forward according to the second data offset information, the second cursor position is obtained;

[0108] For example, the second data offset information is used to indicate the character offset in the local queue of the first client, the local queue being used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes.

[0109] For example, the second data offset information includes a second insertion point and a second data offset.

[0110] For example, when the first cursor position is after the second insertion point, the first cursor position is added to the second data offset to obtain the second cursor position; wherein, when a character is inserted at the second insertion point, the second data offset is a positive number; when a character is deleted at the second insertion point, the second data offset is a negative number.

[0111] For example, after receiving a first collaborator cursor message in data version 100 indicating cursor position 20, the first client inserts two characters at position 1 before applying the first collaborator cursor message. Therefore, the cursor of the second account, originally at position 20, needs to be moved to position 22. That is, in this case, the local queue is not empty; the local queue contains information about the second insertion point (position 1) and the second data offset (+2). Therefore, the first cursor position needs to be added to the second data offset to obtain the second cursor position.

[0112] It should be noted that steps 342 and 344 can be performed selectively, or both can be performed. That is, the data offset information can include only the first data offset information; or only the second data offset information; or both the first and second data offset information.

[0113] That is, if the local queue of the first client is empty, only step 342 can be executed; if the first version is equal to the second version, only step 344 can be executed; if the local queue of the first client is not empty and the first version is not equal to the second version, both steps 342 and 344 are executed.

[0114] This application does not impose any restrictions on the execution method or order of steps 342 and 344.

[0115] Step 360: Display the cursor of the second account at the second cursor position.

[0116] For example, on the user interface of the first client, the cursor of the second account is displayed at the second cursor position.

[0117] Optionally, the user interface of the first client is an interface displayed on the first client for viewing or editing collaborative documents.

[0118] Optionally, the user interface of the first client may include text messages, image messages, video messages, audio messages, symbol messages, etc. The user interface of the first client may also include insert controls, font selection controls, bold controls, italic controls, etc.

[0119] Optionally, the cursor of the second account may be the same as or different from the cursor of the first account; the cursor of the second account may be fixed or jumping. This application does not limit the appearance of the cursor of the second account.

[0120] Optionally, if the cursor position of the first account is changed, the first account needs to broadcast the changed cursor position message to other collaborators.

[0121] For example, the first client receives a cursor position change operation, which is used to change the cursor position of the first account to a third cursor position; based on the third cursor position and third data offset information, a fourth cursor position is determined, wherein the third data offset information is used to indicate the character offset in the local queue of the first client, and the local queue is used to cache data changes that have not yet been confirmed by the server and the character offset corresponding to the data changes; the first client sends a second collaborator cursor message to collaborator accounts other than the first account, which is used to indicate the fourth cursor position corresponding to the first account.

[0122] Optionally, the third cursor position can be offset in the opposite direction according to the third data offset information to obtain the fourth cursor position.

[0123] Optionally, the third data offset information includes at least the third insertion point and the third data offset. If the third cursor position is after the third insertion point, the third data offset is subtracted from the third cursor position to determine the fourth cursor position.

[0124] For example, the first client's current data version is 100, and the document content corresponding to data version 100 is "123456". The first account quickly enters the text "0" at the beginning of the document, and then moves the cursor to the text "6". At this time, the data change of text "0" has not yet been committed to the server, so data cannot be written to disk (i.e., the data change of text "0" is in the local queue). At this time, the cursor position of the first client has changed to position 7 locally. If the cursor message sent by the first client is "[Version: 100, cursor position: 7]", then for the collaborating client, the text displayed locally is still "123456", but it receives a message with cursor position 7, and therefore cannot correctly parse the cursor position.

[0125] Therefore, in the above scenario, the third cursor position is 7, the third insertion point is 0, and the third data offset (the character offset in the first client's local queue) is +1. Since the third cursor position is after the third insertion point, the cursor position of the first account will be affected by the inserted data. The third cursor position needs to be offset in reverse according to the third data offset information; that is, subtract the third data offset 1 from the third cursor position 7 to determine the fourth cursor position as position 6, and then send it to the other collaborators' clients. Through this cursor position backtracking method, the first client's cursor is correctly displayed after the text "6" on the collaborators' clients. After the first client's local queue is submitted and confirmed by the server, a "0" will be automatically added before the text "123456" from the collaborators' perspective; that is, the cursor arrives before the data.

[0126] Optionally, to improve performance and enhance user experience, a threshold for the number of collaborators can be set; if the number of collaborators exceeds the threshold, no notification will be sent. For example, the threshold can be set to 100 collaborators.

[0127] In summary, the method provided in this application calculates the position of the collaborator's cursor based on the received first cursor position and data offset information. It eliminates character offsets between the local data content of the current client and the data content of the collaborative file version corresponding to the received cursor information by using the data offset information. This correctly calculates the position where the collaborator's cursor should be displayed on the current client's user interface, avoiding cursor flickering caused by incorrect calculation of the collaborator's cursor position, improving the efficiency of collaborative document usage, optimizing the cursor experience in collaborative scenarios, and avoiding strong lag and slow network experience for users.

[0128] Furthermore, the method provided in this application embodiment only needs to broadcast the cursor position to the collaborator's client after the first client receives the cursor position change operation, instead of broadcasting the cursor position every time a version update of the collaborative document is received. Especially in large-scale collaborative scenarios, this greatly saves the resource consumption of sending redundant cursor messages and further improves the efficiency of collaborative documents.

[0129] Furthermore, the method provided in this application is universal and can be used normally in extreme environments such as weak network or offline conditions.

[0130] Furthermore, the cursor position backtracking method provided in this application embodiment ensures that the collaborator's cursor arrives before the data change, maintaining consistency with the input experience of a real user.

[0131] Figure 6 A flowchart illustrating a cursor display method for collaborative documents according to an exemplary embodiment of this application is shown. This embodiment uses this method... Figure 3 The example shown illustrates the execution of a first client and a second client, where the first client is logged into a first account and the second client is logged into a second account. The method includes:

[0132] Step 501a: The first client generates a data change;

[0133] For example, the first client generates a data change. For instance, the first account edits a collaborative document, the first client receives the edit, generates a data change, and stores it.

[0134] Step 501b: The second client generates data changes;

[0135] For example, the second client generates data changes. For instance, the second account edits a collaborative document, the second client receives the edit, generates data changes, and stores them.

[0136] It should be noted that steps 501a and 501b can be performed selectively, or both can be performed; the order in which steps 501a and 501b are performed is not important. This application does not impose any restrictions on this.

[0137] Step 502a: Data is stored in a local queue before it is written to disk;

[0138] For example, after data changes are made on the client side, they are first stored in a local queue. The local queue is used to cache data changes that have not yet been confirmed by the server, as well as the character offsets corresponding to the data changes.

[0139] Step 502b: Calculate the offset;

[0140] For example, after the data change generated by the client is submitted to the server and confirmed by the server, the offset of the character offset corresponding to the data change is calculated and stored.

[0141] The data offset can be stored in the form of [Version: 101, Insertion Point: 10, Offset: +1].

[0142] The following example illustrates how to display the cursor in a collaborative document, using the first client logged in with the first account as the cursor message receiver and the second client logged in with the second account as the cursor message sender.

[0143] Steps 503 to 505 are the steps on the cursor message sending side.

[0144] Step 503: Send cursor position change;

[0145] For example, after the second account performs a cursor position change operation, it sends the cursor position change to the second client.

[0146] Step 504: Cursor position backtracking;

[0147] For example, the second client obtains the cursor position for broadcast by subtracting the obtained cursor position from the cached data in the second client's local queue.

[0148] Step 505: Send cursor message;

[0149] For example, the second client broadcasts a cursor message to the collaborating client.

[0150] Steps 506 to 509 are the steps performed by the cursor message receiving side.

[0151] Step 506: Receive cursor position change;

[0152] For example, the first client receives a cursor message from the second client indicating a change in cursor position.

[0153] Step 507: Cursor position conflict handling;

[0154] For example, the first client first compares the first version corresponding to the cursor message with the second version corresponding to the first client. If the first version is less than the second version, the cursor position in the cursor message is accumulated with a data offset based on the version.

[0155] Step 508: Handling cursor position conflicts with the local queue;

[0156] For example, before sending the cursor position after cursor position conflict resolution in step 507 to the business layer, it is also necessary to perform cursor position conflict resolution with the local queue of the first client. That is, if the local queue of the first client is not empty, the data offset in the local queue of the first client is accumulated.

[0157] Step 509: Apply cursor message.

[0158] For example, the final cursor position is applied, and the cursor is rendered at that position.

[0159] Figure 7 A flowchart illustrating a cursor display method for collaborative documents according to an exemplary embodiment of this application is shown. This embodiment uses this method... Figure 3 The example shown illustrates the execution of a first client and a second client, where the first client is logged in with a first account, and the second client is logged in with a second account. Both the first and second accounts are collaborator accounts for the collaborative document. The method includes:

[0160] Step 410: The first client and the second client display the cursor of the second account in the first version of the collaborative document;

[0161] For example, both the first client and the second client correspond to the first version of the collaborative document, and the first client and the second client display the cursor of the second account in the first version of the collaborative document.

[0162] For example, if both the first client and the second client correspond to the first version of the collaborative document and both local queues are empty, the data content of the collaborative document displayed on the first client and the second client is the same, and the cursor position of the displayed second account is also the same.

[0163] Step 420: The first client receives the first data editing operation before the cursor position of the second account; in response to the first data editing operation, it displays that the document content of the collaborative document has been changed from the first version to the second version;

[0164] For example, the first client receives a first data editing operation before the cursor position of the second account, that is, the cursor position of the second account will move due to the influence of the first data editing operation.

[0165] For example, the first client submits the data changes in the first data editing operation to the server and after the server confirms them, the document content of the collaborative document displayed by the first client is updated from the first version to the second version.

[0166] Step 430: The second client receives the first cursor position change operation before the collaborative document is changed to the second version; in response to the first cursor position change operation, the cursor of the second account is changed to the first cursor position in the first version of the collaborative document;

[0167] For example, when the collaborative document is still in its first version, the second account chooses to switch the cursor to the first cursor position; the second client receives the first cursor position change operation before the collaborative document is changed to the second version, and displays the second account's cursor at the first cursor position in the first version of the collaborative document.

[0168] Step 440: The first client displays the second account's cursor in the second version of the collaborative document and changes it to the second cursor position.

[0169] The first and second cursor positions indicate the same input location in both versions of the collaborative document.

[0170] Since the second client receives the first cursor position change operation and sends the cursor position while it is still in the first version, and the first client has been updated to the second version, after receiving the first cursor position of the second account, the first client needs to add the data offset from the first version to the second version to the first cursor position to obtain the second cursor position and display the cursor of the second account at the second cursor position.

[0171] For example, the first client receives a collaborator cursor message, which is used to indicate the first cursor position of the second account; determines the second cursor position based on the first cursor position and first data offset information, which is used to indicate the character offset between the local data content of the first client and the data content of the collaborative document corresponding to the version of the collaborator cursor message; and displays the cursor of the second account at the second cursor position.

[0172] For example, the first data offset information includes information indicating the character offset between the first version corresponding to the collaborator cursor message and the second version corresponding to the first client; or, the first data offset information includes information indicating the character offset in the local queue of the first client, the local queue being used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes; or, the first data offset information includes both of the aforementioned information.

[0173] The implementation of the first data offset information in this embodiment can be found in the aforementioned embodiments, and will not be repeated here.

[0174] For example, the first version is version 100, and the second version is version 101. The data editing operation received by the first client can be stored as [Version: 101, Insertion Point: 10, Offset: +1]. If the collaborator cursor message sent by the second client to the first client is [Version: 100, Cursor Position: 20], the second client will display in the first version of the collaborative document that the cursor of the second account has been moved to the first cursor position 20; the first client, based on the offset between the first and second versions, will display in the second version of the collaborative document that the cursor of the second account has been moved from the cursor position to the second cursor position 21. In fact, the first cursor position 20 and the second cursor position 21 indicate the same input position in both versions of the collaborative document.

[0175] It should be noted that steps 420 and 430 are not executed sequentially. In step 420, the first client receives the data editing operation before the cursor position of the second account, and then upgrades to the second version after the data editing operation is confirmed by the server. Step 430 is executed before the second client upgrades to the second version.

[0176] It should be noted that the method for the first client to determine the second cursor position and display the change of the cursor of the second account from the cursor position to the second cursor position in the second version of the collaborative document in step 440 can be found in the aforementioned embodiments, and will not be repeated here.

[0177] Alternatively, in another possible scenario, the first client sends its cursor message to the second client.

[0178] For example, the first client and the second client display the cursor of the first account in the same version of the collaborative document; the first client receives a second data editing operation; the first client receives a second cursor position change operation; in response to the second cursor position change operation, the first client displays the cursor of the first account in the collaborative document after the second data editing operation, changing it to a third cursor position; the second client displays the cursor of the first account in the collaborative document before the second data editing operation, changing it to a fourth cursor position, wherein the character offset between the third cursor position and the fourth cursor position is the character offset of the editing operation received by the first client before the cursor of the first account.

[0179] For example, the third cursor position is offset in reverse according to the second data offset information to obtain the fourth cursor position. The second data offset information is used to indicate the character offset in the local queue of the first client. The local queue is used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes. Here, the reverse offset means removing the influence of the cached character offsets in the local queue, that is, subtracting all character offsets in the local queue before the insertion point is at the third cursor position from the third cursor position.

[0180] For example, the first client and the second client display the cursor of the first account in the same collaborative document without data modification; then the first client receives a second data editing operation, and the local queue caches data offset information such as [insertion point: 10, offset: +2], that is, the first client inserts 2 characters at position 10; then, the first client receives a second cursor position change operation, such as cursor position 20; then, in response to the second cursor position change operation, the first client displays the cursor of the first account in the collaborative document after data modification, changing it to the third cursor position, that is, position 20; finally, the second client displays the cursor of the first account in the collaborative document before data modification (i.e., the collaborative document without data editing operation), changing it to the fourth cursor position, where the character offset between the third cursor position and the fourth cursor position is the character offset of the editing operation received by the first client before the cursor of the first account, that is, the fourth cursor position is 18.

[0181] In summary, the method provided in this application first displays the cursor of the second account in the same version of the collaborative document corresponding to the first client and the second client. Then, if the first client receives an editing operation and updates its version, but the version corresponding to the second client is not updated, the second client receives a cursor position change operation. Finally, the cursor position of the second account displayed on the updated collaborative document on the first client is the same as the input position indicated by the cursor position of the second account displayed on the unupdated collaborative document on the second client. This method can correctly calculate the position where the user cursor should be displayed on the user interface of each collaborator's client, improving the efficiency of using collaborative documents.

[0182] It should be noted that this solution stores all data on the client side, employing a distributed storage approach, which significantly reduces service and storage overhead. However, in principle, the same effect can be achieved by storing the aforementioned data offset information on the server side, and implementing cursor position conflict and cursor position backtracking techniques through cloud functions. This application does not impose any restrictions on this.

[0183] It should be noted that in this scheme, data changes and cursor messages are transmitted separately. In principle, if data changes and cursor messages were combined into a single message, the backtracking work could be reduced. This application does not impose any restrictions on this.

[0184] Figure 8 A structural block diagram of a cursor display device for collaborative documents provided in an exemplary embodiment of this application is shown. The device is logged into a first account and includes:

[0185] The receiving module 620 is used to receive a first collaborator cursor message, which is used to indicate the first cursor position of the second account. Both the second account and the first account are collaborator accounts of the collaborative document.

[0186] The determining module 630 is used to determine the second cursor position based on the first cursor position and the data offset information, wherein the data offset information is used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the first collaborator cursor message;

[0187] Display module 640 is used to display the cursor of the second account at the second cursor position.

[0188] In one possible design, the data offset information includes at least one first data offset information, which is used to indicate the character offset between the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client; the determining module 630 is used to obtain the second cursor position by positively offsetting the first cursor position according to the first data offset information when the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client.

[0189] In one possible design, the first data offset information includes a first insertion point and a first data offset; the determining module 630 is used to add the first data offset to the first cursor position to obtain the second cursor position when the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client and the first cursor position is after the first insertion point; wherein, when a character is inserted at the first insertion point, the first data offset is a positive number; when a character is deleted at the first insertion point, the first data offset is a negative number.

[0190] In one possible design, the determining module 630 is further configured to: store the first data offset based on data changes of other collaborator accounts besides the first account; and store the first data offset based on data changes successfully submitted to the server by the first account and confirmed by the server.

[0191] In one possible design, the data offset information includes second data offset information, which is used to indicate the character offset in the local queue of the first client. The local queue is used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes. The determining module 630 is used to offset the first cursor position in the positive direction according to the second data offset information to obtain the second cursor position.

[0192] In one possible design, the second data offset information includes a second insertion point and a second data offset; the determining module 630 is used to add the first cursor position and the second data offset to obtain the second cursor position when the first cursor position is after the second insertion point; wherein, when a character is inserted at the second insertion point, the second data offset is a positive number; when a character is deleted at the second insertion point, the second data offset is a negative number.

[0193] In one possible design, the receiving module 620 is used to store the first collaborator cursor message into a cursor message cache pool when the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client are different; the determining module 630 is used to perform the step of determining the second cursor position based on the first cursor position and data offset information.

[0194] In one possible design, the cursor message cache pool includes a low-version cursor message cache pool and a high-version cursor message cache pool; the receiving module 620 is used to store the first collaborator cursor message in the low-version cursor message cache pool when the first version is lower than the second version; and to store the first collaborator cursor message in the high-version cursor message cache pool when the first version is higher than the second version.

[0195] In one possible design, the determining module 630 is configured to update the document version corresponding to the first client when the first version is greater than the second version; display the cursor position of the second account based on the first cursor position when the first version is equal to the updated second version; and perform the step of determining the second cursor position based on the first cursor position and data offset information when the first version is less than the updated second version.

[0196] In one possible design, the receiving module 620 is used to receive a cursor position change operation, which is used to change the cursor position of the first account to a third cursor position; the determining module 630 is used to determine a fourth cursor position based on the third cursor position and third data offset information, where the third data offset information is used to indicate the character offset in the local queue of the first client, and the local queue is used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes; the device further includes a sending module 650, used to send a second collaborator cursor message to collaborator accounts other than the first account, whereby the second collaborator cursor message is used to indicate the fourth cursor position corresponding to the first account.

[0197] In one possible design, the determining module 630 is used to obtain the fourth cursor position by offsetting the third cursor position in the reverse direction according to the third data offset information.

[0198] In one possible design, the third data offset information includes at least a third insertion point and a third data offset; the determining module 630 is used to determine the fourth cursor position by subtracting the third data offset from the third cursor position when the third cursor position is located after the third insertion point.

[0199] Figure 9 This illustration shows a structural block diagram of a cursor display device for a collaborative document provided in an exemplary embodiment of this application. The device includes a first sub-device 720 logged into a first account and a second sub-device 730 logged into a second account, wherein both the second account and the first account are collaborator accounts for the collaborative document. The device includes:

[0200] The display module 722 of the first sub-device is used to display the cursor of the second account in the first version of the collaborative document; the display module 732 of the second sub-device is used to display the cursor of the second account in the first version of the collaborative document.

[0201] The receiving module 724 of the first sub-device is used to receive a first data editing operation before the cursor position of the second account; the display module 722 of the first sub-device is used to display the document content of the collaborative document changed from the first version to the second version in response to the first data editing operation.

[0202] The receiving module 734 of the second sub-device is used to receive the first cursor position change operation before the collaborative document is changed to the second version; the display module 732 of the second sub-device is used to display in the first version of the collaborative document that the cursor of the second account has been changed to the first cursor position in response to the first cursor position change operation.

[0203] The display module 722 of the first sub-device is used to display in the second version of the collaborative document that the cursor of the second account has been changed to a second cursor position, and the first cursor position and the second cursor position indicate the same input position in both versions of the collaborative document.

[0204] In one possible design, the display module 722 of the first sub-device is configured to receive a collaborator cursor message, the collaborator cursor message being used to indicate a first cursor position of the second account; determine a second cursor position based on the first cursor position and first data offset information, the first data offset information being used to indicate a character offset between the local data content of the first client and the data content of the collaborative document corresponding to the version of the collaborator cursor message; and display the cursor of the second account at the second cursor position.

[0205] In one possible design, the display module 722 of the first sub-device and the display module 732 of the second sub-device are used to display the cursor of the first account in the same version of the collaborative document;

[0206] The receiving module 724 of the first sub-device is used to receive the second data editing operation;

[0207] The receiving module 724 of the first sub-device is used to receive the second cursor position change operation; the display module 722 of the first sub-device is used to respond to the second cursor position change operation and display the cursor of the first account to the third cursor position in the collaborative document after the second data editing operation.

[0208] The display module 732 of the second sub-device is used to display in a collaborative document that has not undergone the second data editing operation that the cursor of the first account has been changed to the fourth cursor position, wherein the character offset between the third cursor position and the fourth cursor position is the character offset of the editing operation received by the first client before the cursor of the first account.

[0209] This application also provides a computer device (terminal) including a processor and a memory. The memory stores at least one instruction, which is loaded and executed by the processor to implement the cursor display method for collaborative documents provided in the above-described method embodiments. It should be noted that the computer device can be as follows: Figure 10 The computer equipment provided.

[0210] like Figure 10 As shown, the computer device 1000 may include a processor 1001, a network interface 1004, and a memory 1005. Furthermore, the computer device 1000 may also include a target user interface 1003 and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. The target user interface 1003 may include a display screen and a keyboard; optionally, the target user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the processor 1001. Figure 10 As shown, the memory 1005, which is a computer-readable storage medium, may include an operating system, a network communication module, a target user interface module, and a device control application.

[0211] exist Figure 10In the computer device 1000 shown, the network interface 1004 provides network communication functions; the target user interface 1003 is mainly used to provide an input interface for the target user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to implement the cursor display method of collaborative documents.

[0212] It should be understood that the computer device 1000 described in the embodiments of this application can perform the foregoing... Figures 4 to 7 The description of the cursor display method for collaborative documents in any corresponding embodiment will not be repeated here.

[0213] This application provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by the processor to implement the cursor display method for collaborative documents provided in the above-described method embodiments.

[0214] This application also provides a computer program product that, when run on a computer, causes the computer to execute the cursor display method for collaborative documents provided in the above-described method embodiments.

[0215] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0216] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0217] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for displaying the cursor in a collaborative document, characterized in that, The method is executed by the first client that logs in to the first account, and the method includes: Receive a first collaborator cursor message, which is used to indicate the first cursor position of the second account. Both the second account and the first account are collaborator accounts of the collaborative document. The second cursor position is determined based on the first cursor position and the data offset information, wherein the data offset information is used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the first collaborator cursor message; Display the cursor of the second account at the second cursor position; The data offset information includes first data offset information and second data offset information; the first data offset information is used to indicate the character offset between the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client; the second data offset information is used to indicate the character offset in the local queue of the first client, the local queue being used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes; the first cursor position and the second cursor position indicate the same input position in the two versions of the collaborative document; any data change will be updated to the corresponding version of the collaborative document content only after being confirmed by the server; Determining the second cursor position based on the first cursor position and data offset information includes: The second cursor position is obtained by positively offsetting the first cursor position according to the first data offset information and the second data offset information.

2. The method according to claim 1, characterized in that, Determining the second cursor position based on the first cursor position and data offset information includes: If the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client, the first cursor position is shifted forward according to the first data offset information to obtain the second cursor position.

3. The method according to claim 2, characterized in that, The first data offset information includes the first insertion point and the first data offset amount; When the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client, the step of shifting the first cursor position forward according to the first data offset information to obtain the second cursor position includes: If the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client and the first cursor position is located after the first insertion point, the first cursor position is added to the first data offset to obtain the second cursor position; Specifically, when a character is inserted at the first insertion point, the first data offset is a positive number; when a character is deleted at the first insertion point, the first data offset is a negative number.

4. The method according to claim 3, characterized in that, The method further includes at least one of the following steps: Based on data changes of other collaborator accounts besides the first account, store the first data offset; Based on the data changes successfully submitted to the server by the first account and confirmed by the server, the first data offset is stored.

5. The method according to claim 1, characterized in that, The second data offset information includes the second insertion point and the second data offset. The process of obtaining the second cursor position by positively offsetting the first cursor position according to the second data offset information includes: If the first cursor position is located after the second insertion point, add the first cursor position to the second data offset to obtain the second cursor position; Specifically, when a character is inserted at the second insertion point, the second data offset is a positive number; when a character is deleted at the second insertion point, the second data offset is a negative number.

6. The method according to any one of claims 2 to 5, characterized in that, The method further includes: If the first version corresponding to the first collaborator cursor message is different from the second version corresponding to the first client, the first collaborator cursor message is stored in the cursor message cache pool. Perform the step of determining the second cursor position based on the first cursor position and data offset information.

7. The method according to claim 6, characterized in that, The cursor message cache pool includes a low-version cursor message cache pool and a high-version cursor message cache pool; The step of storing the first collaborator cursor message in the cursor message cache pool when the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client are different includes: If the first version is lower than the second version, the first collaborator cursor message is stored in the low-version cursor message cache pool; If the first version is higher than the second version, the first collaborator cursor message is stored in the higher version cursor message cache pool.

8. The method according to claim 6, characterized in that, The method further includes: If the first version is greater than the second version, update the document version corresponding to the first client; If the first version is equal to the updated second version, display the cursor position of the second account based on the first cursor position; If the first version is less than the updated second version, the step of determining the second cursor position based on the first cursor position and data offset information is performed.

9. The method according to any one of claims 1 to 5, 7-8, characterized in that, The method further includes: Receive cursor position change operation, the cursor position change operation is used to change the cursor position of the first account to the third cursor position; The fourth cursor position is determined based on the third cursor position and the third data offset information, wherein the third data offset information is used to indicate the character offset in the local queue of the first client; Send a second collaborator cursor message to collaborator accounts other than the first account. The second collaborator cursor message is used to indicate the fourth cursor position corresponding to the first account.

10. The method according to claim 6, characterized in that, The method further includes: Receive cursor position change operation, the cursor position change operation is used to change the cursor position of the first account to the third cursor position; The fourth cursor position is determined based on the third cursor position and the third data offset information, wherein the third data offset information is used to indicate the character offset in the local queue of the first client; Send a second collaborator cursor message to collaborator accounts other than the first account. The second collaborator cursor message is used to indicate the fourth cursor position corresponding to the first account.

11. The method according to claim 9, characterized in that, Determining the fourth cursor position based on the third cursor position and the third data offset information includes: The third cursor position is offset in the reverse direction according to the third data offset information to obtain the fourth cursor position.

12. The method according to claim 10, characterized in that, Determining the fourth cursor position based on the third cursor position and the third data offset information includes: The third cursor position is offset in the reverse direction according to the third data offset information to obtain the fourth cursor position.

13. The method according to claim 11, characterized in that, The third data offset information includes at least the third insertion point and the third data offset amount; The step of offsetting the third cursor position in reverse according to the third data offset information to obtain the fourth cursor position includes: If the third cursor position is located after the third insertion point, the third data offset is subtracted from the third cursor position to determine the fourth cursor position.

14. The method according to claim 12, characterized in that, The third data offset information includes at least the third insertion point and the third data offset amount; The step of offsetting the third cursor position in reverse according to the third data offset information to obtain the fourth cursor position includes: If the third cursor position is located after the third insertion point, the third data offset is subtracted from the third cursor position to determine the fourth cursor position.

15. A method for displaying a cursor in a collaborative document, characterized in that, The method is executed by a first client logged into a first account and a second client logged into a second account, wherein both the second account and the first account are collaborator accounts for the collaborative document. The method includes: The first client and the second client display the cursor of the second account in the first version of the collaborative document; The first client receives a first data editing operation before the cursor position of the second account; in response to the first data editing operation, it displays a change to the document content of the collaborative document from the first version to the second version; The second client receives a first cursor position change operation before the collaborative document is changed to the second version; in response to the first cursor position change operation, the second account's cursor is changed to the first cursor position in the first version of the collaborative document; The first client receives a first collaborator cursor message sent by the second client, the first collaborator cursor message being used to indicate the first cursor position; determines a second cursor position based on the first cursor position and data offset information, the data offset information being used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the first collaborator cursor message; displays in the second version of the collaborative document that the cursor of the second account is changed to the second cursor position, the first cursor position and the second cursor position indicating the same input position in both versions of the collaborative document; The data offset information includes first data offset information and second data offset information; the first data offset information is used to indicate the character offset between the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client; the second data offset information is used to indicate the character offset in the local queue of the first client, the local queue is used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes; any data change will be updated to the version of the document content of the collaborative document after being confirmed by the server; Determining the second cursor position based on the first cursor position and data offset information includes: The second cursor position is obtained by positively offsetting the first cursor position according to the first data offset information and the second data offset information.

16. The method according to claim 15, characterized in that, The method further includes: The first client and the second client display the cursor of the first account in the same version of the collaborative document; The first client receives the second data editing operation; The first client receives a second cursor position change operation; in response to the second cursor position change operation, the first account's cursor is changed to a third cursor position in the collaborative document after the second data editing operation; The second client displays the cursor of the first account in a collaborative document that has not undergone the second data editing operation, changing it to the fourth cursor position. The character offset between the third cursor position and the fourth cursor position is the character offset of the editing operation received by the first client before the cursor of the first account.

17. A cursor display device for collaborative documents, characterized in that, The device is logged into a first account, and the device includes: The receiving module is used to receive a first collaborator cursor message, which is used to indicate the first cursor position of the second account. Both the second account and the first account are collaborator accounts of the collaborative document. The determination module is used to determine the second cursor position based on the first cursor position and data offset information, wherein the data offset information is used to indicate the character offset between the local document content of the first client and the document content of the version corresponding to the first collaborator cursor message; The display module is used to display the cursor of the second account at the second cursor position; The data offset information includes first data offset information and second data offset information; the first data offset information is used to indicate the character offset between the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client; the second data offset information is used to indicate the character offset in the local queue of the first client, the local queue being used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes; the first cursor position and the second cursor position indicate the same input position in the two versions of the collaborative document; any data change will be updated to the corresponding version of the collaborative document content only after being confirmed by the server; Determining the second cursor position based on the first cursor position and data offset information includes: The second cursor position is obtained by positively offsetting the first cursor position according to the first data offset information and the second data offset information.

18. The apparatus according to claim 17, characterized in that, The determining module is used for: If the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client, the first cursor position is shifted forward according to the first data offset information to obtain the second cursor position.

19. The apparatus according to claim 18, characterized in that, The first data offset information includes the first insertion point and the first data offset amount; The determining module is used for: If the first version corresponding to the first collaborator cursor message is less than the second version corresponding to the first client and the first cursor position is located after the first insertion point, the first cursor position is added to the first data offset to obtain the second cursor position; Specifically, when a character is inserted at the first insertion point, the first data offset is a positive number; when a character is deleted at the first insertion point, the first data offset is a negative number.

20. The apparatus according to claim 19, characterized in that, The determining module is also used in at least one of the following steps: Based on data changes of other collaborator accounts besides the first account, store the first data offset; Based on the data changes successfully submitted to the server by the first account and confirmed by the server, the first data offset is stored.

21. The apparatus according to claim 17, characterized in that, The second data offset information includes the second insertion point and the second data offset. The determining module is used for: If the first cursor position is located after the second insertion point, add the first cursor position to the second data offset to obtain the second cursor position; Specifically, when a character is inserted at the second insertion point, the second data offset is a positive number; when a character is deleted at the second insertion point, the second data offset is a negative number.

22. The apparatus according to any one of claims 18 to 21, characterized in that, The receiving module is used to store the first collaborator cursor message into a cursor message cache pool when the first version corresponding to the first collaborator cursor message and the second version corresponding to the first client are different. The determining module is used to perform the step of determining the second cursor position based on the first cursor position and data offset information.

23. The apparatus according to claim 22, characterized in that, The cursor message cache pool includes a low-version cursor message cache pool and a high-version cursor message cache pool; The receiving module is used for: If the first version is lower than the second version, the first collaborator cursor message is stored in the low-version cursor message cache pool; If the first version is higher than the second version, the first collaborator cursor message is stored in the higher version cursor message cache pool.

24. The apparatus according to claim 22, characterized in that, The determining module is used for: If the first version is greater than the second version, update the document version corresponding to the first client; If the first version is equal to the updated second version, display the cursor position of the second account based on the first cursor position; If the first version is less than the updated second version, the step of determining the second cursor position based on the first cursor position and data offset information is performed.

25. The apparatus according to any one of claims 17 to 21, 23-24, characterized in that, The receiving module is used to receive a cursor position change operation, which is used to change the cursor position of the first account to a third cursor position. The determining module is used to determine the fourth cursor position based on the third cursor position and the third data offset information, wherein the third data offset information is used to indicate the character offset in the local queue of the first client. The device further includes a sending module for sending a second collaborator cursor message to collaborator accounts other than the first account, the second collaborator cursor message being used to indicate the fourth cursor position corresponding to the first account.

26. The apparatus according to claim 22, characterized in that, The receiving module is used to receive a cursor position change operation, which is used to change the cursor position of the first account to a third cursor position. The determining module is used to determine the fourth cursor position based on the third cursor position and the third data offset information, wherein the third data offset information is used to indicate the character offset in the local queue of the first client. The device further includes a sending module for sending a second collaborator cursor message to collaborator accounts other than the first account, the second collaborator cursor message being used to indicate the fourth cursor position corresponding to the first account.

27. The apparatus according to claim 25, characterized in that, The determining module is used for: The third cursor position is offset in the reverse direction according to the third data offset information to obtain the fourth cursor position.

28. The apparatus according to claim 26, characterized in that, The determining module is used for: The third cursor position is offset in the reverse direction according to the third data offset information to obtain the fourth cursor position.

29. The apparatus according to claim 27, characterized in that, The third data offset information includes at least the third insertion point and the third data offset amount; The determining module is used to determine the fourth cursor position by subtracting the third data offset from the third cursor position when the third cursor position is located after the third insertion point.

30. The apparatus according to claim 28, characterized in that, The third data offset information includes at least the third insertion point and the third data offset amount; The determining module is used to determine the fourth cursor position by subtracting the third data offset from the third cursor position when the third cursor position is located after the third insertion point.

31. A cursor display device for collaborative documents, characterized in that, The device includes a first sub-device logged into a first account and a second sub-device logged into a second account, wherein both the second account and the first account are collaborator accounts for the collaborative document. The device includes: The display module of the first sub-device is used to display the cursor of the second account in the first version of the collaborative document; the display module of the second sub-device is used to display the cursor of the second account in the first version of the collaborative document. The receiving module of the first sub-device is used to receive a first data editing operation before the cursor position of the second account; the display module of the first sub-device is used to display, in response to the first data editing operation, that the document content of the collaborative document has been changed from the first version to the second version. The receiving module of the second sub-device is used to receive the first cursor position change operation before the collaborative document is changed to the second version; the display module of the second sub-device is used to display in the first version of the collaborative document, in response to the first cursor position change operation, that the cursor of the second account is changed to the first cursor position; The display module of the first sub-device is configured to receive a first collaborator cursor message, which indicates the first cursor position; determine a second cursor position based on the first cursor position and data offset information, where the data offset information indicates the character offset between the local document content of the first sub-device and the document content of the version corresponding to the first collaborator cursor message; and display in the second version of the collaborative document that the cursor of the second account is changed to the second cursor position, wherein the first cursor position and the second cursor position indicate the same input position in both versions of the collaborative document. The data offset information includes first data offset information and second data offset information; the first data offset information is used to indicate the character offset between the first version corresponding to the first collaborator cursor message and the second version corresponding to the first sub-device; the second data offset information is used to indicate the character offset in the local queue of the first sub-device, the local queue being used to cache data changes that have not yet been confirmed by the server and the character offsets corresponding to the data changes; any data change will be updated to the corresponding version of the collaborative document content after being confirmed by the server; Determining the second cursor position based on the first cursor position and data offset information includes: The second cursor position is obtained by positively offsetting the first cursor position according to the first data offset information and the second data offset information.

32. The apparatus according to claim 31, characterized in that, The device further includes: The display modules of the first sub-device and the second sub-device are used to display the cursor of the first account in the same version of the collaborative document; The receiving module of the first sub-device is used to receive the second data editing operation; The receiving module of the first sub-device is used to receive the second cursor position change operation; in response to the second cursor position change operation, the cursor of the first account is changed to the third cursor position in the collaborative document after the second data editing operation; The display module of the second sub-device is used to display in a collaborative document that has not undergone the second data editing operation that the cursor of the first account has been changed to the fourth cursor position, wherein the character offset between the third cursor position and the fourth cursor position is the character offset of the editing operation received by the first sub-device before the cursor of the first account.

33. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, at least one program, a code set, or an instruction set, the at least one instruction, the at least one program, the code set, or the instruction set being loaded and executed by the processor to implement the cursor display method for collaborative documents as described in any one of claims 1 to 14, or the cursor display method for collaborative documents as described in any one of claims 15 to 16.

34. A computer-readable storage medium, characterized in that, The readable storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the cursor display method for collaborative documents as described in any one of claims 1 to 14, or the cursor display method for collaborative documents as described in any one of claims 15 to 16.

35. A computer program product, characterized in that, The computer program product stores at least one instruction, at least one program segment, code set, or instruction set, wherein the at least one instruction, the at least one program segment, the code set, or the instruction set is loaded and executed by a processor to implement the cursor display method for collaborative documents as described in any one of claims 1 to 14, or the cursor display method for collaborative documents as described in any one of claims 15 to 16.

Citation Information

Patent Citations

  • Collaborative cursors in a hosted word processor

    CN102934105A