GTextEditor: Make the line_widget_rect() span the widget horizontally.

This commit is contained in:
Andreas Kling 2019-04-24 23:15:15 +02:00
parent 4bea3a4aa6
commit f1eba2295d

View file

@ -597,11 +597,10 @@ 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() + ruler_width() + 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.set_x(frame_thickness());
rect.set_width(frame_inner_rect().width());
rect.move_by(0, -(vertical_scrollbar().value()));
rect.intersect(this->rect());
// This feels rather hackish, but extend the rect to the edge of the content view:
rect.set_right(frame_inner_rect().right());
return rect;
}