summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c5
-rw-r--r--src/ui/sidebarwidget.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 0d931080..7cd51561 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -302,7 +302,7 @@ static int documentWidth_DocumentWidget_(const iDocumentWidget *d) {
302 const iWidget *w = constAs_Widget(d); 302 const iWidget *w = constAs_Widget(d);
303 const iRect bounds = bounds_Widget(w); 303 const iRect bounds = bounds_Widget(w);
304 const iPrefs * prefs = prefs_App(); 304 const iPrefs * prefs = prefs_App();
305 return iMini(bounds.size.x - gap_UI * d->pageMargin * 2, 305 return iMini(iMax(50 * gap_UI, bounds.size.x - gap_UI * d->pageMargin * 2),
306 fontSize_UI * prefs->lineWidth * prefs->zoomPercent / 100); 306 fontSize_UI * prefs->lineWidth * prefs->zoomPercent / 100);
307} 307}
308 308
@@ -2984,6 +2984,9 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) {
2984 const iWidget *w = constAs_Widget(d); 2984 const iWidget *w = constAs_Widget(d);
2985 const iRect bounds = bounds_Widget(w); 2985 const iRect bounds = bounds_Widget(w);
2986 iVisBuf * visBuf = d->visBuf; /* will be updated now */ 2986 iVisBuf * visBuf = d->visBuf; /* will be updated now */
2987 if (width_Rect(bounds) <= 0) {
2988 return;
2989 }
2987 draw_Widget(w); 2990 draw_Widget(w);
2988 allocVisBuffer_DocumentWidget_(d); 2991 allocVisBuffer_DocumentWidget_(d);
2989 const iRect ctxWidgetBounds = init_Rect( 2992 const iRect ctxWidgetBounds = init_Rect(
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index ca4404d5..0c17995e 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -564,8 +564,11 @@ static void checkModeButtonLayout_SidebarWidget_(iSidebarWidget *d) {
564} 564}
565 565
566void setWidth_SidebarWidget(iSidebarWidget *d, int width) { 566void setWidth_SidebarWidget(iSidebarWidget *d, int width) {
567 iWidget *w = as_Widget(d); 567 iWidget * w = as_Widget(d);
568 width = iClamp(width, 30 * gap_UI, rootSize_Window(get_Window()).x - 50 * gap_UI); 568 /* Even less space if the other sidebar is visible, too. */
569 const int otherWidth =
570 width_Widget(findWidget_App(d->side == left_SideBarSide ? "sidebar2" : "sidebar"));
571 width = iClamp(width, 30 * gap_UI, rootSize_Window(get_Window()).x - 50 * gap_UI - otherWidth);
569 d->width = width; 572 d->width = width;
570 if (isVisible_Widget(w)) { 573 if (isVisible_Widget(w)) {
571 w->rect.size.x = width; 574 w->rect.size.x = width;