draw all line backgrounds first
This commit is contained in:
@@ -10,7 +10,8 @@ RavenLog is a viewer for text files of arbitrary length.
|
|||||||
* Case insensitive filtering enabled by default.
|
* Case insensitive filtering enabled by default.
|
||||||
* Filter matches are highlighted (can be disabled).
|
* Filter matches are highlighted (can be disabled).
|
||||||
* Filter results don't disappear when changing tabs.
|
* Filter results don't disappear when changing tabs.
|
||||||
* Colored highlighting of lines or matches based on regular expression.
|
* Colored highlighting based on regular expression filters.
|
||||||
|
* Different colors for line background and match.
|
||||||
* Pleasing color palette.
|
* Pleasing color palette.
|
||||||
* Highlighters are automatically saved and restored.
|
* Highlighters are automatically saved and restored.
|
||||||
* Select arbitrary strings (not just fill lines).
|
* Select arbitrary strings (not just fill lines).
|
||||||
@@ -18,3 +19,4 @@ RavenLog is a viewer for text files of arbitrary length.
|
|||||||
* Triple click selects line.
|
* Triple click selects line.
|
||||||
* Copy protection: Users is warned before creating a clipboard more than 5 MB in size. They can choose to copy the
|
* Copy protection: Users is warned before creating a clipboard more than 5 MB in size. They can choose to copy the
|
||||||
selection into a new file instead.
|
selection into a new file instead.
|
||||||
|
* Optionally open a new tab when saving selection as file.
|
||||||
|
|||||||
35
bigtext.py
35
bigtext.py
@@ -373,11 +373,13 @@ class InnerBigText(QWidget):
|
|||||||
# draws over a character
|
# draws over a character
|
||||||
y_line_offset = self.char_height;
|
y_line_offset = self.char_height;
|
||||||
for l in self.lines:
|
for l in self.lines:
|
||||||
|
highlight_ranges = []
|
||||||
for h in highlighters:
|
for h in highlighters:
|
||||||
optional_highlight_range = h.compute_highlight(l)
|
optional_highlight_range = h.compute_highlight(l)
|
||||||
if optional_highlight_range:
|
if optional_highlight_range:
|
||||||
for highlight in optional_highlight_range:
|
highlight_ranges = highlight_ranges + optional_highlight_range
|
||||||
self.draw_highlight(highlight, painter, y_line_offset)
|
|
||||||
|
self.draw_highlights(highlight_ranges, painter, y_line_offset)
|
||||||
y_line_offset = y_line_offset + self.char_height
|
y_line_offset = y_line_offset + self.char_height
|
||||||
|
|
||||||
left_offset = -1 * self._left_offset * self.char_width
|
left_offset = -1 * self._left_offset * self.char_width
|
||||||
@@ -388,21 +390,26 @@ class InnerBigText(QWidget):
|
|||||||
|
|
||||||
painter.end()
|
painter.end()
|
||||||
|
|
||||||
def draw_highlight(self, highlight: HighlightedRange, painter: QPainter, y_line_offset: int):
|
def draw_highlights(self, highlights: [HighlightedRange], painter: QPainter, y_line_offset: int):
|
||||||
left_offset = -1 * self._left_offset * self.char_width
|
|
||||||
x1 = highlight.get_start() * self.char_width
|
|
||||||
width = highlight.get_width() * self.char_width
|
|
||||||
|
|
||||||
y1 = y_line_offset - self.char_height + self.char_height / 7
|
for highlight in highlights:
|
||||||
height = self.char_height
|
if highlight.is_highlight_full_line():
|
||||||
|
left_offset = -1 * self._left_offset * self.char_width
|
||||||
|
y1 = y_line_offset - self.char_height + self.char_height / 7
|
||||||
|
height = self.char_height
|
||||||
|
full_width = Settings.max_line_length() * self.char_width
|
||||||
|
rect = QRect(left_offset, y1, full_width, height)
|
||||||
|
self.highlight_background(painter, rect, highlight.get_brush_full_line())
|
||||||
|
|
||||||
if highlight.is_highlight_full_line():
|
for highlight in highlights:
|
||||||
full_width = Settings.max_line_length() * self.char_width
|
left_offset = -1 * self._left_offset * self.char_width
|
||||||
rect = QRect(left_offset, y1, full_width, height)
|
x1 = highlight.get_start() * self.char_width
|
||||||
self.highlight_background(painter, rect, highlight.get_brush_full_line())
|
width = highlight.get_width() * self.char_width
|
||||||
|
y1 = y_line_offset - self.char_height + self.char_height / 7
|
||||||
|
height = self.char_height
|
||||||
|
|
||||||
rect = QRect(left_offset + x1, y1, width, height)
|
rect = QRect(left_offset + x1, y1, width, height)
|
||||||
self.highlight_background(painter, rect, highlight.get_brush())
|
self.highlight_background(painter, rect, highlight.get_brush())
|
||||||
|
|
||||||
def highlight_background(self, painter: QPainter, rect: QRect, brush: QBrush):
|
def highlight_background(self, painter: QPainter, rect: QRect, brush: QBrush):
|
||||||
old_brush = painter.brush()
|
old_brush = painter.brush()
|
||||||
|
|||||||
Reference in New Issue
Block a user