You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Text.split() method will call Text.divide() method, in that method, the IndexError may occur in certain situations. It says:" IndexError: list index out of range"
When the variable "end_line_no" = line_count = len(line_ranges), it will raise a IndexError.
If span_end > line_end, variable end_line_no may continue to increase until it equals line_count. There is no corresponding restriction to limit the value of end_line_no within the correct range. I don’t know why the value of span_end is greater than end_line, but I can only say that in some cases, at least in my code, it does occur. [The error message provided clearly indicates that the span_end at the time was 104 while the text_length (which equals to end_line) was 100 , sometimes they are other values.]
I have temporarily fixed this problem by adding some codes like
Describe the bug
There is a function which counts the length of each line as below when i use "Textual" :
The Text.split() method will call Text.divide() method, in that method, the IndexError may occur in certain situations. It says:" IndexError: list index out of range"
Here are the reasons why this error occurs:
The divide() method comes from the source file text.py in rich as below:
https://github.com/Textualize/rich/blob/68224905f5dc7a3c765e04aba0460b75a95f5004/rich/text.py
The divede() method starts at line #1051 ( to prevent from seeing different positions)
When the variable "end_line_no" = line_count = len(line_ranges), it will raise a IndexError.
If span_end > line_end, variable end_line_no may continue to increase until it equals line_count. There is no corresponding restriction to limit the value of end_line_no within the correct range. I don’t know why the value of span_end is greater than end_line, but I can only say that in some cases, at least in my code, it does occur. [The error message provided clearly indicates that the span_end at the time was 104 while the text_length (which equals to end_line) was 100 , sometimes they are other values.]
I have temporarily fixed this problem by adding some codes like
after line #1113 and #1097, and this bug has not occurred again.
Platform
Click to expand
I use Termux in an Andorid pad.
Python version is 3.11.3.
The text was updated successfully, but these errors were encountered: