only-draw-visible-stuff #2
@@ -504,7 +504,7 @@ class InnerBigText(QWidget):
|
||||
y_line_offset = self.char_height
|
||||
for line in self.lines:
|
||||
text = line.line_prepared_for_display()
|
||||
leftmost_visible_char_index = line.column_to_char(self._left_offset - 1)
|
||||
leftmost_visible_char_index = line.column_to_char(self._left_offset)
|
||||
rightmost_visible_char_index = line.column_to_char(self._left_offset + math.ceil(self.columns_shown()))
|
||||
text = text[
|
||||
leftmost_visible_char_index:rightmost_visible_char_index] # reduce string to the visible section before drawing
|
||||
@@ -532,7 +532,13 @@ class InnerBigText(QWidget):
|
||||
y1 = y_line_offset - self.char_height + self.char_height / 7
|
||||
height = self.char_height
|
||||
|
||||
rect = QRect(round(x1 - left_offset), round(y1), round(width), round(height))
|
||||
left = round(x1 - left_offset)
|
||||
if x1 + width < left_offset \
|
||||
or x1 > left_offset + self.width():
|
||||
# too far left or too far right
|
||||
continue
|
||||
|
||||
rect = QRect(left, round(y1), round(width), round(height))
|
||||
self.highlight_background(painter, rect, highlight.get_brush())
|
||||
|
||||
def highlight_background(self, painter: QPainter, rect: QRect, brush: QBrush):
|
||||
|
||||
Reference in New Issue
Block a user