From 8999367652c8711cb666b95665a18ce87b7d713e Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 13 Mar 2019 17:52:05 +0100 Subject: [PATCH] tui: fix tbrowsablewidget size --- src/be/nikiroo/jexer/TBrowsableWidget.java | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/be/nikiroo/jexer/TBrowsableWidget.java b/src/be/nikiroo/jexer/TBrowsableWidget.java index aa18d09..81ca630 100644 --- a/src/be/nikiroo/jexer/TBrowsableWidget.java +++ b/src/be/nikiroo/jexer/TBrowsableWidget.java @@ -386,19 +386,31 @@ abstract public class TBrowsableWidget extends TScrollableWidget { } private void fixScrollers() { - vScroller.setX(Math.max(0, getWidth() - 3)); - vScroller.setHeight(Math.max(1, getHeight() - 2)); - hScroller.setY(Math.max(0, getHeight() - 3)); - hScroller.setWidth(Math.max(1, getWidth() - 3)); + int width = getWidth() - 1; // vertical prio + int height = getHeight(); + + // TODO: why did we do that before? + if (false) { + width -= 2; + height = -1; + } + + int x = Math.max(0, width); + int y = Math.max(0, height - 1); + + vScroller.setX(x); + vScroller.setHeight(height); + hScroller.setY(y); + hScroller.setWidth(width); // virtual_size // - the other scroll bar size - // + 2 (for the border of the window) + // - 2 (for the border of the window) vScroller.setTopValue(0); vScroller.setBottomValue(Math.max(0, getVirtualHeight() - getHeight() - + hScroller.getHeight() + 2)); + - hScroller.getHeight() - 2)); hScroller.setLeftValue(0); hScroller.setRightValue(Math.max(0, getVirtualWidth() - getWidth() - + vScroller.getWidth() + 2)); + - vScroller.getWidth() - 2)); } } -- 2.27.0