From 63d2b26b17dfac2f723484215efd84397bbc154c Mon Sep 17 00:00:00 2001 From: networkException Date: Mon, 15 May 2023 21:33:36 +0200 Subject: [PATCH] LibVT: Correctly wrap text when the scrollbar is hidden --- Userland/Libraries/LibVT/TerminalWidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 7de7f08cef8..e9d2a78ba85 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018-2021, Andreas Kling * Copyright (c) 2022, the SerenityOS developers. + * Copyright (c) 2023, networkException * * SPDX-License-Identifier: BSD-2-Clause */ @@ -527,7 +528,7 @@ void TerminalWidget::relayout(Gfx::IntSize size) Gfx::IntSize TerminalWidget::compute_base_size() const { - int base_width = frame_thickness() * 2 + m_inset * 2 + m_scrollbar->width(); + int base_width = frame_thickness() * 2 + m_inset * 2 + (m_scrollbar->is_visible() ? m_scrollbar->width() : 0); int base_height = frame_thickness() * 2 + m_inset * 2; return { base_width, base_height }; } @@ -557,6 +558,7 @@ void TerminalWidget::set_opacity(u8 new_opacity) void TerminalWidget::set_show_scrollbar(bool show_scrollbar) { m_scrollbar->set_visible(show_scrollbar); + relayout(size()); } bool TerminalWidget::has_selection() const