Lagrange [release]
SidebarWidget: Minimum and maximum widths considering both sidebars
[1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m
[1mindex 0d931080..7cd51561 100644[m
[1m--- a/src/ui/documentwidget.c[m
[1m+++ b/src/ui/documentwidget.c[m
[36m@@ -302,7 +302,7 @@[m [mstatic int documentWidth_DocumentWidget_(const iDocumentWidget *d) {[m
const iWidget *w = constAs_Widget(d);[m
const iRect bounds = bounds_Widget(w);[m
const iPrefs * prefs = prefs_App();[m
[31m- return iMini(bounds.size.x - gap_UI * d->pageMargin * 2,[m
[32m+[m[32m return iMini(iMax(50 * gap_UI, bounds.size.x - gap_UI * d->pageMargin * 2),[m
fontSize_UI * prefs->lineWidth * prefs->zoomPercent / 100);[m
}[m
[m
[36m@@ -2984,6 +2984,9 @@[m [mstatic void draw_DocumentWidget_(const iDocumentWidget *d) {[m
const iWidget *w = constAs_Widget(d);[m
const iRect bounds = bounds_Widget(w);[m
iVisBuf * visBuf = d->visBuf; /* will be updated now */[m
[32m+[m[32m if (width_Rect(bounds) <= 0) {[m
[32m+[m[32m return;[m
[32m+[m[32m }[m
draw_Widget(w);[m
allocVisBuffer_DocumentWidget_(d);[m
const iRect ctxWidgetBounds = init_Rect([m
[1mdiff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c[m
[1mindex ca4404d5..0c17995e 100644[m
[1m--- a/src/ui/sidebarwidget.c[m
[1m+++ b/src/ui/sidebarwidget.c[m
[36m@@ -564,8 +564,11 @@[m [mstatic void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) {[m
}[m
[m
void setWidth_SidebarWidget(iSidebarWidget *d, int width) {[m
[31m- iWidget *w = as_Widget(d);[m
[31m- width = iClamp(width, 30 * gap_UI, rootSize_Window(get_Window()).x - 50 * gap_UI);[m
[32m+[m[32m iWidget * w = as_Widget(d);[m
[32m+[m[32m /* Even less space if the other sidebar is visible, too. */[m
[32m+[m[32m const int otherWidth =[m
[32m+[m[32m width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar"));[m
[32m+[m[32m width = iClamp(width, 30 * gap_UI, rootSize_Window(get_Window()).x - 50 * gap_UI - otherWidth);[m
d->width = width;[m
if (isVisible_Widget(w)) {[m
w->rect.size.x = width;[m