diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-19 02:45:23 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-19 02:45:49 +0100 |
commit | 46577a69486212b03ae0b94767cb2264d178dc40 (patch) | |
tree | 0b7f58a0adf3d27f5b49ec263ccb769bfe873e1d /LibGUI | |
parent | a0411f61f8884bc1bd09e6ffe46d226c1c7b4ee2 (diff) | |
download | serenity-46577a69486212b03ae0b94767cb2264d178dc40.zip |
GTextEditor: Fix invalidation glitches in single-line mode.
Diffstat (limited to 'LibGUI')
-rw-r--r-- | LibGUI/GTextEditor.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp index 1b26201058..5a4d61584e 100644 --- a/LibGUI/GTextEditor.cpp +++ b/LibGUI/GTextEditor.cpp @@ -159,7 +159,8 @@ void GTextEditor::paint_event(GPaintEvent& event) painter.save(); painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value()); - painter.translate(ruler_width(), 0); + if (m_ruler_visible) + painter.translate(ruler_width(), 0); int exposed_width = max(content_width(), width()); int first_visible_line = text_position_at(event.rect().top_left()).line(); @@ -182,7 +183,7 @@ void GTextEditor::paint_event(GPaintEvent& event) } } - painter.set_clip_rect({ ruler_rect.right() + 1, 0, width() - width_occupied_by_vertical_scrollbar() - ruler_width(), height() - height_occupied_by_horizontal_scrollbar() }); + painter.set_clip_rect({ m_ruler_visible ? (ruler_rect.right() + 1) : 0, 0, width() - width_occupied_by_vertical_scrollbar() - ruler_width(), height() - height_occupied_by_horizontal_scrollbar() }); for (int i = first_visible_line; i <= last_visible_line; ++i) { auto& line = *m_lines[i]; @@ -469,7 +470,7 @@ Rect GTextEditor::cursor_content_rect() const Rect GTextEditor::line_widget_rect(int line_index) const { auto rect = line_content_rect(line_index); - rect.move_by(-(horizontal_scrollbar().value() - m_horizontal_content_padding), -(vertical_scrollbar().value())); + rect.move_by(-(horizontal_scrollbar().value() + m_horizontal_content_padding), -(vertical_scrollbar().value())); rect.set_width(rect.width() + 1); // Add 1 pixel for when the cursor is on the end. rect.intersect(this->rect()); // This feels rather hackish, but extend the rect to the edge of the content view: |