From 06c777027707b8e17a7791cb37f250303a48a18b Mon Sep 17 00:00:00 2001 From: Utkarsh khambra Date: Sat, 17 Dec 2022 22:29:55 +0530 Subject: [PATCH] Don't include scrollbar width in total viewport width --- src/contour/display/TerminalWidget.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/contour/display/TerminalWidget.cpp b/src/contour/display/TerminalWidget.cpp index ce3ca2f740..1ff336a423 100644 --- a/src/contour/display/TerminalWidget.cpp +++ b/src/contour/display/TerminalWidget.cpp @@ -528,15 +528,18 @@ void TerminalWidget::initializeGL() void TerminalWidget::resizeGL(int _width, int _height) { - QOpenGLWidget::resizeGL(_width, _height); + Width const width = + profile().scrollbarPosition == config::ScrollBarPosition::Hidden + ? Width::cast_from(_width - qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent)) + : Width::cast_from(_width); + QOpenGLWidget::resizeGL(width.as(), _height); if (!session_) return; - auto const qtBaseWidgetSize = - terminal::ImageSize { Width::cast_from(_width), Height::cast_from(_height) }; + auto const qtBaseWidgetSize = terminal::ImageSize { width, Height::cast_from(_height) }; auto const newPixelSize = qtBaseWidgetSize * contentScale(); - DisplayLog()("Resizing view to {}x{} virtual ({} actual).", _width, _height, newPixelSize); + DisplayLog()("Resizing view to {}x{} virtual ({} actual).", width, _height, newPixelSize); applyResize(newPixelSize, *session_, *renderer_); }