summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorofftkp <parisoplop@gmail.com>2022-05-08 04:02:53 +0300
committerLinus Groh <mail@linusgroh.de>2022-05-09 22:52:05 +0200
commit62d41d58d613b22caa5a3324c278511f8678c8d6 (patch)
treeaa0333ab95f4c78111958459c73fa287966a6225 /Userland
parenta20bf80b050659466a1bd118d594103c20ec3e6d (diff)
downloadserenity-62d41d58d613b22caa5a3324c278511f8678c8d6.zip
LibGUI: Consider TextEditor icon size when scrolling text horizontally
If an icon exists and the horizontal scroll value is larger than 0, translate the TextEditor painter by the icon size and padding. The text would scroll over the icon when the text was long enough to trigger a horizontal scroll. Fixes #13669.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 1852b68399..31d76c82d4 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -452,7 +452,10 @@ void TextEditor::paint_event(PaintEvent& event)
painter.draw_line(ruler_rect.top_right(), ruler_rect.bottom_right(), palette().ruler_border());
}
- painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
+ auto horizontal_scrollbar_value = horizontal_scrollbar().value();
+ painter.translate(-horizontal_scrollbar_value, -vertical_scrollbar().value());
+ if (m_icon && horizontal_scrollbar_value > 0)
+ painter.translate(min(icon_size() + icon_padding(), horizontal_scrollbar_value), 0);
painter.translate(gutter_width(), 0);
painter.translate(ruler_width(), 0);