Text display method and device, equipment and storage medium

By detecting updates in the text component and determining the truncation strategy, using the text measurer to determine the truncation position and displaying the truncation indicator element, the problem that traditional text processing methods cannot match the needs of diversified layouts is solved, and the reliability and user experience of text display are improved .

CN119003074APending Publication Date: 2024-11-22BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411103277.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

Traditional text processing methods such as fixed-length truncation or simple scroll bars cannot match diverse layout requirements and user expectations, resulting in lost information or poor user experience.

Method used

Provides a text display method, by detecting the update of text components, determines the target truncation strategy (truncated by line or word), uses the corresponding text measurer to determine the truncation position, and displays the truncation indicator element in the text component.

Benefits of technology

Improve the reliability of the display of text components in the page, avoid undesired situations such as text overflow, and enhance the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003074A_ABST
    Figure CN119003074A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a text display method and device, equipment and a storage medium. The method provided herein includes: in response to detecting an update associated with a text component, determining a target truncation policy associated with the text component, the target truncation policy including a first truncation policy and / or a second truncation policy, the first truncation policy indicating truncation by row number and the second truncation policy indicating truncation by word number; determining a target truncation position of the text component by using a text measurer corresponding to the target truncation strategy; and displaying a truncation indication element in the text component based on the target truncation position. In this way, the embodiment of the invention can support dynamic display updating of the text component so as to trigger truncation of contents in the text component.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to a text display method, apparatus, device, and computer-readable storage medium. Background Art

[0002] With the rapid development of smart devices, text display often faces the challenge of space limitations in scenarios such as mobile devices. Traditional text processing methods, such as fixed-length truncation or simple scroll bars, often fail to match diverse layout requirements and user expectations. These methods may result in information loss or poor user experience. Summary of the invention

[0003] In a first aspect of the present disclosure, a text display method is provided. The method comprises: in response to detecting an update associated with a text component, determining a target truncation strategy associated with the text component, the target truncation strategy comprising a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicating truncation by number of lines, and the second truncation strategy indicating truncation by number of words; using a text measurer corresponding to the target truncation strategy, determining a target truncation position of the text component; and displaying a truncation indication element in the text component based on the target truncation position.

[0004] In a second aspect of the present disclosure, a text display device is provided. The device includes: a first determination module, configured to determine a target truncation strategy associated with the text component in response to detecting an update associated with the text component, the target truncation strategy including a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicating truncation by the number of lines, and the second truncation strategy indicating truncation by the number of words; a second determination module, configured to determine a target truncation position of the text component using a text measurer corresponding to the target truncation strategy; and an element display module, configured to display a truncation indication element in the text component based on the target truncation position.

[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.

[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.

[0007] In a fifth aspect of the present disclosure, a computer program product is provided, which includes computer executable instructions, and when the instructions are executed by a processor, the method according to the first aspect of the present disclosure is implemented.

[0008] It should be understood that the contents described in this content section are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0010] Figure 1 A schematic diagram showing an example environment in which embodiments according to the present disclosure may be implemented;

[0011] Figure 2 A flowchart illustrating an example process of text display according to some embodiments of the present disclosure;

[0012] Figure 3 An example flow chart of display control of a text component according to some embodiments of the present disclosure is shown;

[0013] Figure 4 An example flow chart for determining a truncation position according to some embodiments of the present disclosure is shown;

[0014] Figure 5 An example flow chart of determining a truncation position according to still other embodiments of the present disclosure is shown;

[0015] Figure 6 A schematic structural block diagram showing an example text display device according to some embodiments of the present disclosure; and

[0016] Figure 7 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0018] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various embodiments are described throughout this article, and any type of embodiment may be included under any section / subsection. In addition, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or different sections / subsections.

[0019] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.

[0020] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects are subject to the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user knows and confirms. Accordingly, when implementing each embodiment of the present disclosure, the type, scope of use, usage scenario, etc. of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method can vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.

[0021] In this specification and the embodiments, if personal information processing is involved, it will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or it is necessary to perform a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.

[0022] As mentioned above, traditional text processing methods, such as fixed-length truncation or simple scroll bars, often fail to match diverse layout requirements and user expectations. These methods may result in information loss or poor user experience.

[0023] The embodiment of the present disclosure proposes a text display scheme. The scheme includes: in response to detecting an update associated with a text component, determining a target truncation strategy associated with the text component, the target truncation strategy including a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicating truncation by the number of lines, and the second truncation strategy indicating truncation by the number of words; using a text measurer corresponding to the target truncation strategy, determining a target truncation position of the text component; and displaying a truncation indication element in the text component based on the target truncation position.

[0024] In this way, the embodiments of the present disclosure can support dynamic display updates for text components to trigger truncation of content in the text components. Thus, the embodiments of the present disclosure can improve the reliability of text component display in a page and avoid unexpected situations such as text overflow.

[0025] Various example implementations of the solution are described in detail below in conjunction with the accompanying drawings.

[0026] Example Environment

[0027] Figure 1 1 is a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. Figure 1 As shown, example environment 100 may include electronic device 110 .

[0028] In the example environment 100, the electronic device 110 may obtain the code 120 of the text component 130 and accordingly render the text component 130. For example, the text component 130 may include any appropriate module for displaying text content in a graphical user interface.

[0029] In some embodiments, the electronic device 110 may control the display of the content in the text component 130 based on the truncation policy. For example, the electronic device 110 may ensure that the number of lines of the content displayed in the text component 130 does not exceed a predetermined number of lines, and / or ensure that the number of words of the content displayed in the text component 130 does not exceed a predetermined number of words.

[0030] In some examples, when the number of lines and / or words of the content corresponding to the text component 130 exceeds a predetermined number of lines and / or words, the electronic device 110 may truncate the content and may display a truncation indication element 140 at a corresponding position.

[0031] The truncation indicator element 140 may include any appropriate content for indicating that the content in the text component 130 is truncated. In some examples, the truncation indicator element 140 may include a preset truncation indicator element, or the truncation indicator element 140 may be determined based on a configuration code in the code 120, for example.

[0032] For example, the truncation indicator element 140 may include the text “click to expand”. Additionally, such a truncation indicator element 140 may also be associated with a preset control logic. For example, the truncation indicator element 140 may trigger the adjustment of the display size of the text component 130 to display more content.

[0033] The specific display process of the text component 130 will be referred to below. Figures 2 to 5 Detailed description.

[0034] In some embodiments, the electronic device 110 can be any type of mobile terminal, fixed terminal or portable terminal, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, handheld computers, portable game terminals, VR / AR devices, personal communication systems (PCS) devices, personal navigation devices, personal digital assistants (PDA), audio / video players, digital cameras / camcorders, positioning devices, television receivers, radio broadcast receivers, e-book devices, game devices, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. In some embodiments, the electronic device 110 can also support any type of interface for the user (such as "wearable" circuits, etc.).

[0035] In some embodiments, the electronic device 110 may also be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud code units, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. The electronic device 110 may include, for example, a computing system / server, such as a mainframe, an edge computing node, a computing device in a cloud environment, and the like.

[0036] It should be understood that the structure and function of the various elements in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.

[0037] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.

[0038] Example Process

[0039] Figure 2 1 is a flowchart of an example process 200 for displaying text according to some embodiments of the present disclosure. The process 200 may be implemented at the electronic device 110. Figure 1Process 200 is described.

[0040] In box 210, the electronic device 110 determines a target truncation strategy associated with the text component in response to detecting an update associated with the text component, the target truncation strategy includes a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicates truncation by the number of lines, and the second truncation strategy indicates truncation by the number of words.

[0041] The following will refer to Figure 3 The process 200 is described below. Figure 3 An example flow chart 300 of display control of a text component according to some embodiments of the present disclosure is shown.

[0042] In some embodiments, electronic device 110 may detect updates associated with a text component. Figure 3 As shown, in block 302, the electronic device 110 may initialize the text component and construct a listener in block 310. Such a listener may include a first listener for monitoring content changes and / or a second listener for monitoring changes in display properties (e.g., size) of the text component.

[0043] like Figure 3 As shown, at block 304, the first listener may monitor content changes of the text component. At block 306, the second listener may monitor size changes of the text component. Additionally, at block 308, the electronic device 110 may also determine changes in other display properties (e.g., display state) of the text component.

[0044] like Figure 3 As shown, when at least one of the above updates is detected, the electronic device 110 can pause the listener in box 312 and detect whether the content of the text component has changed in box 314. Specifically, the electronic device 110 can determine the current content from the repository 316 and determine whether the content to be displayed is different from the current content.

[0045] If it is determined that the content has changed, the electronic device 110 may revert the changes in block 318 so that the text component is associated with the latest content.

[0046] Continue to refer Figure 2 In block 220 , the electronic device 110 determines a target truncation position of the text component using a text meter corresponding to the target truncation strategy.

[0047] like Figure 3As shown, in box 320, the electronic device 110 can create a typesetter, which uses a corresponding text measurer to determine the target truncation position of the text component. Further, the electronic device 110 can use the typesetter to determine whether the text component includes text data corresponding to the target truncation strategy. In response to determining that the text component includes text data, the electronic device 110 can determine the target truncation position based on the text data. On the contrary, the electronic device 110 may not perform truncation processing, for example.

[0048] As will be described in detail below, the electronic device 110 may obtain node data associated with the text component (eg, Figure 4 Node data in 446 and / or Figure 5 Node data 522 in the text component). The node data may describe multiple nodes in the text component. Further, the electronic device 110 may utilize a corresponding text measurer and determine whether the text component includes text data corresponding to the target truncation strategy based on the node data.

[0049] Specifically, Figure 3 As shown, in block 322, the electronic device 110 may determine whether line truncation is required. If line truncation is required, the electronic device 110 may determine a first truncation position using a first text meter corresponding to a first truncation strategy in block 324.

[0050] The following will refer to Figure 4 To describe the specific process of determining the first truncation position. Figure 4 An example flow chart 400 for determining a truncation location according to some embodiments of the present disclosure is shown.

[0051] Specifically, Figure 4 As shown, typesetter 402 may determine a target truncation position corresponding to a stage line number (eg, the Nth line) using a text meter for measuring text lines.

[0052] Specifically, at block 404, the typesetter 402 may obtain text data corresponding to the Nth line (i.e., the number of truncated lines, indicating that at most N lines are displayed). At block 406, the typesetter 402 may determine whether the Nth line of data exists in the line data storage module 408. If the line data storage module 408 includes the Nth line of data, the typesetter 402 may return the Nth line of data at block 424, and further determine the first truncation position (e.g., the Xth character) corresponding to the Nth line.

[0053] In contrast, if the line data storage module 408 does not include text data, then at block 410 , the typesetter 402 may determine a first node from the line data storage module 408 , wherein the first node corresponds to the last line stored by the line data storage module 408 .

[0054] Further, in block 412 , the electronic device 110 may find a subsequent node of the first node, ie, the (m+1)th node, based on the node data 446 .

[0055] In some embodiments, node data 446 may be used to describe one or more properties of a node in a text component. For example, node data 446 may be used to describe the type of the node.

[0056] In some examples, nodes in a text component may, for example, include a first node type (also referred to as a text node), where the first node type corresponds to text content that is allowed to span multiple lines of the text component.

[0057] In some examples, nodes in a text component may, for example, include a second node type (also referred to as a content node), where the content corresponding to the second node type is restricted to a single line of the text component.

[0058] In some examples, nodes in the text component may include, for example, a third node type (also referred to as an inline-text node) that allows styles to be applied and can span multiple lines. Since an inline-text node can be further split into one or more text nodes and / or content nodes, the node types maintained in the node data 446 may, for example, only include the first node type and the second node type.

[0059] Additionally, the node data 446 may also store the starting position (e.g., the serial number of the starting character) and the ending position (the serial number of the ending character) of the node. Additionally, the node data 446 may also store the index of the node. In some examples, the index may be incremented, for example, according to the order of the node in the text component.

[0060] Continue to refer Figure 4 , the node information buffer 430 may return the information of the m+1th node based on the node information storage module 448. Specifically, in block 432, the electronic device 110 may receive a request to obtain the m+1th node information, and determine in block 434 whether the corresponding information is maintained in the node information storage module 448. If the node information storage module 448 stores the corresponding information, the electronic device 110 may return the corresponding information in block 442.

[0061] On the contrary, if there is no corresponding information in the node information storage module 448, the electronic device 110 can use the traverser 444 to obtain the information of the next node in box 436. Further, the electronic device 110 can determine whether the next node is a third node type (i.e., an inline-text node) in box 438. If so, the electronic device 110 can further traverse to the next node.

[0062] On the contrary, if the node is the first node type or the second node type, then in box 440, the electronic device 110 can store the node information in the node information storage module 448 and return to box 434 to determine whether there is corresponding node information based on the updated node information storage module 448.

[0063] Further, returning to the processing of the typeset 402, at block 414, the typeset 402 may further determine whether the retrieved node is a text node. If so, at block 416, the typeset 402 may determine the display boundary of the node, such as the boundary of one or more rectangles, using a function corresponding to a text node. Conversely, at block 418, the typeset 402 may determine the display boundary of the node, such as the boundary of one or more rectangles, using a function corresponding to a content node.

[0064] Further, in block 420, the typesetter 402 may determine whether a new row exists based on the boundary information. For example, if the display area of ​​the node includes multiple rectangular boxes and there is a jump in the boundary position of the rectangular boxes, it can be determined that the node triggers a new row.

[0065] If there is no new row, the typesetter 402 can return to block 412 and obtain the node information of the next node. If there is a new row, the typesetter 402 can update the row data storage module 408 accordingly and return to block 406 to determine whether there is data corresponding to the truncated row number (i.e., the Nth row) based on the updated row data storage module 408.

[0066] Therefore, the embodiments of the present disclosure can utilize a text meter corresponding to line truncation to dynamically determine a truncation position corresponding to the number of truncation lines.

[0067] Continue to refer Figure 3 In block 326, the electronic device 110 may determine whether truncation by word count (ie, number of characters) is required. If truncation by word count is required, the electronic device 110 may determine a second truncation position using a second text measurer corresponding to a second truncation strategy in block 328.

[0068] The following will refer to Figure 5 To describe the specific process of determining the first truncation position. Figure 5 An example flow chart 500 for determining a truncation location according to some embodiments of the present disclosure is shown.

[0069] In some embodiments, the electronic device 110 may determine whether to include a target node corresponding to the number of truncated words (eg, N characters) based on the node data 522 .

[0070] Specifically, in block 502, the electronic device 110 may receive a request to obtain a node corresponding to the Nth character. In block 504, the electronic device 110 may cyclically obtain node information of a plurality of nodes.

[0071] Specifically, at block 510, the electronic device 110 may receive a request to obtain the Xth node. Further, the electronic device 110 may determine at block 512 whether the node data storage module 524 stores corresponding information. If so, the electronic device 110 may return the information of the Xth node at block 520.

[0072] On the contrary, if the node data storage module 512 does not include the information of the Xth node, the electronic device 110 can use the traverser 526 to obtain the information of the next node in box 514. Further, the electronic device 110 can determine whether the next node is a third node type (i.e., an inline-text node) in box 516. If so, the electronic device 110 can further traverse to the next node.

[0073] On the contrary, if the node is of the first node type or the second node type, then in box 518, the electronic device 110 may store the node information corresponding to the node in the node data 522 into the node information storage module 524, and return to box 512 to determine whether there is corresponding node information.

[0074] In block 506 , the electronic device 110 may determine whether the start position of the node is before the truncated word number and whether the end position is after the truncated word number, ie, the start position is less than N and the node number position is greater than N.

[0075] If the node is found, the electronic device 110 may return the node in block 508. Otherwise, the electronic device 110 may further acquire node information of the next node.

[0076] Therefore, the embodiments of the present disclosure can utilize a text meter corresponding to truncation by word count to dynamically determine a truncation position corresponding to the truncation word count.

[0077] Continue to refer Figure 3 If the target truncation strategy includes both the first truncation strategy of truncation by line and the second truncation strategy of truncation by word number, the electronic device 110 may further determine the target truncation position of the text component based on the comparison between the first truncation position and the second truncation position in block 330. For example, the target truncation position may be the front position (e.g., the Zth character) between the first truncation position (e.g., the Xth character) and the second truncation position (e.g., the Yth character).

[0078] On the contrary, if only the first truncation strategy or only the second truncation strategy is executed, the electronic device 110 may directly determine the first truncation position or the second truncation position as the target truncation position.

[0079] Continue to refer Figure 2 In box 230, the electronic device 110 displays a truncation indication element in the text component based on the target truncation position.

[0080] Continue to refer Figure 3 In block 332, the electronic device 110 may determine a node corresponding to the target truncation position (e.g., the Zth character). Further, if it is determined in block 334 that the truncation indicator element needs to be displayed, the electronic device 110 may determine a first length of the truncation indicator element in block 336, and may determine a target display position of the truncation indicator element based on the target truncation position and the first length.

[0081] Specifically, Figure 3 As shown, in box 338, the electronic device 110 can select a target character from the second node corresponding to the target truncation position (eg, the Zth character), and can determine a second length from the target character to the tail position of the text component.

[0082] In block 340 , the electronic device 110 may determine whether the second length is greater than the first length of the truncation indicator element. If so, in block 348 , the electronic device 110 may determine the position of the target character as the target display position.

[0083] Further, in block 350, the electronic device 110 may obtain a node corresponding to the target display position. In block 352, the electronic device 110 may truncate the node, update the content corresponding to the text component, and update the repository 316. Additionally, in block 354, the electronic device 110 may resume monitoring updates.

[0084] On the contrary, if the second length is less than or equal to the first length, the electronic device 110 can determine whether the target character is the first character of the node in box 342. If not, the electronic device 110 can determine the previous character of the target character in the current node as the new target character in box 344, thereby updating the second length. Further, the electronic device 110 can return to box 340 to perform a comparison of the updated second length with the first length.

[0085] In some examples, if the target character is the first character in the current node and the second length is still less than or equal to the first length, the electronic device 110 may determine a preceding node of the node in box 346 .

[0086] Further, the electronic device 110 may repeat the steps of frame 338 to frame 346 to determine the target display position based on at least one preceding node until the third length from the target display position to the tail position is greater than the first length.

[0087] In this way, the embodiments of the present disclosure can ensure the correct display of the truncation indication element.

[0088] Based on the process described above, the embodiments of the present disclosure can support dynamic display update of text components to trigger truncation of content in the text components. Thus, the embodiments of the present disclosure can improve the reliability of text component display in a page and avoid unexpected situations such as text overflow.

[0089] Example devices and equipment

[0090] The embodiments of the present disclosure also provide corresponding devices for implementing the above methods or processes. Figure 6 A schematic structural block diagram of an example apparatus 600 for text display according to some embodiments of the present disclosure is shown. The apparatus 600 may be implemented as or included in the electronic device 110. Each module / component in the apparatus 600 may be implemented by hardware, software, firmware or any combination thereof.

[0091] like Figure 6 As shown, the device 600 includes a first determination module 610, which is configured to determine a target truncation strategy associated with the text component in response to detecting an update associated with the text component, the target truncation strategy including a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicating truncation by the number of lines, and the second truncation strategy indicating truncation by the number of words; a second determination module 620, which is configured to determine a target truncation position of the text component using a text meter corresponding to the target truncation strategy; and an element display module 630, which is configured to display a truncation indication element in the text component based on the target truncation position.

[0092] In some embodiments, the updating includes at least one of the following: updating of the content in the text component; updating of the display properties of the text component; the text component being initialized.

[0093] In some embodiments, the second determination module 620 is further configured to: create a typesetter corresponding to the text component; use the typesetter to determine whether the text component includes text data corresponding to the target truncation strategy; and in response to the text component including the text data, determine the target truncation position based on the text data.

[0094] In some embodiments, the second determination module 620 is further configured to: obtain node data associated with the text component, the node data describing multiple nodes in the text component; and utilize the text measurer to determine, based on the node data, whether the text component includes the text data corresponding to the target truncation strategy.

[0095] In some embodiments, the node data describes at least one of the following attributes of the corresponding node: the type of the node; the starting position and the ending position of the node; the index of the node.

[0096] In some embodiments, the types include: a first node type, which corresponds to text content, and the text content is allowed to span multiple lines of the text component; or a second node type, and the content corresponding to the second node type is limited to a single line of the text component.

[0097] In some embodiments, the target truncation strategy is the first truncation strategy, and the second determination module 620 is further configured to: determine whether the text data corresponding to the truncation row number is included from the row data storage module; in response to the row data storage module not including the text data, determine a first node from the row data storage module, the first node corresponding to the tail row stored in the row data storage module; determine whether the node data includes at least one subsequent node of the first node; in response to the node data including the at least one subsequent node, update the row data storage module based on the at least one subsequent node; and determine whether the text data corresponding to the truncation row number is included based on the updated row data storage module.

[0098] In some embodiments, the target truncation strategy is the second truncation strategy, and the second determination module 620 is further configured to: determine whether to include a target node corresponding to the number of truncation words based on the node data.

[0099] In some embodiments, the target truncation strategy includes the first truncation strategy and the second truncation strategy, and the second determination module 620 is also configured to: determine the first truncation position using a first text measurer corresponding to the first truncation strategy; determine the second truncation position using a second text measurer corresponding to the second truncation strategy; and determine the target truncation position of the text component based on a comparison of the first truncation position and the second truncation position.

[0100] In some embodiments, the element display module 630 is further configured to: determine a target display position based on the target truncation position and the first length of the truncation indicator element; and display the truncation indicator element at the target display position.

[0101] In some embodiments, the element display module 630 is also configured to: select a target character from a second node corresponding to the target truncation position; and in response to a second length from the target character to the tail position of the text component being greater than the first length, determine the position of the target character as the target display position.

[0102] In some embodiments, the element display module 630 is also configured to: in response to the target character being the first character in the second node and the second length being less than or equal to the first length, determine at least one preceding node of the second node; and based on the at least one preceding node, determine the target display position so that the third length from the target display position to the tail position is greater than the first length.

[0103] In some embodiments, the truncation indication element includes: a preset truncation indication element; or a truncation indication element determined based on a configuration code.

[0104] The modules included in the device 600 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the modules in the device 600 can be implemented at least in part by one or more hardware logic components. As an example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0105] Figure 7 1 shows a block diagram of an electronic device 700 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 7 The electronic device 700 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Figure 7 The electronic device 700 shown can be used to implement Figure 1 An electronic device 110.

[0106] like Figure 7As shown, the electronic device 700 is in the form of a general electronic device. The components of the electronic device 700 may include, but are not limited to, one or more processors or processing units 710, a memory 720, a storage device 730, one or more communication units 740, one or more input devices 750, and one or more output devices 760. The processing unit 710 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 720. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 700.

[0107] The electronic device 700 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the electronic device 700, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 720 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 730 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 700.

[0108] The electronic device 700 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 7 As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 720 may include a computer program product 725 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.

[0109] The communication unit 740 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 700 can be implemented with a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 700 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.

[0110] The input device 750 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 760 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 700 may also communicate with one or more external devices (not shown) through the communication unit 740 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 700, or communicate with any device that allows the electronic device 700 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0111] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0112] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0113] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0114] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0115] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0116] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.

Claims

1. A text display method, comprising: In response to detecting an update associated with a text component, determining a target truncation strategy associated with the text component, the target truncation strategy comprising a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicating truncation by number of lines, the second truncation strategy indicating truncation by number of words; Determining a target truncation position of the text component using a text measurer corresponding to the target truncation strategy; and Based on the target truncation position, a truncation indication element is displayed in the text component.

2. The method of claim 1, wherein the updating comprises at least one of the following: Updating of the content in the text component; Updating of display properties of the text component; The text component is initialized.

3. The method according to claim 1, wherein determining the target truncation position of the text component using a text measurer corresponding to the truncation strategy comprises: Creating a typesetter corresponding to the text component; determining, using the typesetter, whether the text component includes text data corresponding to the target truncation strategy; as well as In response to the text component including the text data, the target truncation position is determined based on the text data.

4. The method according to claim 3, wherein determining, using the typesetter, whether the text component includes text data corresponding to the target truncation strategy comprises: Obtaining node data associated with the text component, the node data describing a plurality of nodes in the text component; as well as Using the text measurer, it is determined based on the node data whether the text component includes the text data corresponding to the target truncation strategy.

5. The method according to claim 4, wherein the node data describes at least one of the following attributes of the corresponding node: The type of node; The starting and ending positions of the nodes; The index of the node.

6. The method of claim 5, wherein the types include: a first node type, the first node type corresponding to text content, the text content being allowed to span multiple lines of the text component; or A second node type, wherein the content corresponding to the second node type is limited to a single line of the text component.

7. The method according to claim 4, wherein the target truncation strategy is the first truncation strategy, and determining whether the text component includes the text data corresponding to the target truncation strategy based on the node data comprises: Determine from the row data storage module whether the text data corresponding to the number of truncated rows is included; In response to the row data storage module not including the text data, determining a first node from the row data storage module, the first node corresponding to a tail row stored in the row data storage module; determining whether the node data includes at least one subsequent node of the first node; In response to the node data including the at least one subsequent node, updating the row data storage module based on the at least one subsequent node; as well as Based on the updated line data storage module, it is determined whether the text data corresponding to the truncated line number is included.

8. The method according to claim 4, wherein the target truncation strategy is the second truncation strategy, and determining whether the text component includes the text data corresponding to the target truncation strategy based on the node data comprises: Based on the node data, it is determined whether to include a target node corresponding to the number of truncated words.

9. The method according to claim 1, wherein the target truncation strategy includes the first truncation strategy and the second truncation strategy, and determining the target truncation position of the text component using a text measurer corresponding to the target truncation strategy comprises: determining a first truncation position using a first text measurer corresponding to the first truncation strategy; determining a second truncation position using a second text measurer corresponding to the second truncation strategy; as well as Based on a comparison between the first truncation position and the second truncation position, the target truncation position of the text component is determined.

10. The method according to claim 1, wherein displaying a truncation indication element in the text component based on the target truncation position comprises: Determining a target display position based on the target truncation position and a first length of the truncation indication element; as well as The truncation indication element is displayed at the target display position.

11. The method according to claim 10, wherein determining the target display position based on the target truncation position and the first length of the truncation indicator element comprises: Selecting a target character from a second node corresponding to the target truncation position; as well as In response to a second length from the target character to the tail position of the text component being greater than the first length, the position of the target character is determined as the target display position.

12. The method according to claim 11, wherein determining the target display position based on the target truncation position and the first length of the truncation indicator element further comprises: In response to the target character being the first character in the second node and the second length being less than or equal to the first length, determining at least one preceding node of the second node; as well as Based on the at least one preceding node, the target display position is determined so that a third length from the target display position to the tail position is greater than the first length.

13. The method according to claim 1, wherein the truncation indicator element comprises: Preset truncation indicator elements; or A truncation indicator element determined based on the configuration code.

14. A text display device, comprising: A first determination module is configured to determine, in response to detecting an update associated with a text component, a target truncation strategy associated with the text component, the target truncation strategy comprising a first truncation strategy and / or a second truncation strategy, the first truncation strategy indicating truncation by the number of lines, and the second truncation strategy indicating truncation by the number of words; A second determination module is configured to determine a target truncation position of the text component using a text measurer corresponding to the target truncation strategy; as well as The element display module is configured to display a truncation indication element in the text component based on the target truncation position.

15. An electronic device, comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 13 when executed by the at least one processing unit.

16. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 13.

17. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 13.