diff options
-rw-r--r-- | src/gmdocument.c | 2 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index ae9f6d9c..e33be932 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -523,7 +523,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
523 | run.flags |= quoteBorder_GmRunFlag; | 523 | run.flags |= quoteBorder_GmRunFlag; |
524 | } | 524 | } |
525 | rightMargin = (type == text_GmLineType || type == bullet_GmLineType || | 525 | rightMargin = (type == text_GmLineType || type == bullet_GmLineType || |
526 | type == link_GmLineType || type == quote_GmLineType ? 5 : 0); | 526 | type == quote_GmLineType ? 4 : 0); |
527 | iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */ | 527 | iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */ |
528 | while (!isEmpty_Range(&runLine)) { | 528 | while (!isEmpty_Range(&runLine)) { |
529 | run.bounds.pos = addX_I2(pos, indent * gap_Text); | 529 | run.bounds.pos = addX_I2(pos, indent * gap_Text); |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 0722976a..92966538 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -351,10 +351,14 @@ static void requestFinished_DocumentWidget_(iAnyObject *obj) { | |||
351 | } | 351 | } |
352 | 352 | ||
353 | static int documentWidth_DocumentWidget_(const iDocumentWidget *d) { | 353 | static int documentWidth_DocumentWidget_(const iDocumentWidget *d) { |
354 | const iWidget *w = constAs_Widget(d); | 354 | const iWidget *w = constAs_Widget(d); |
355 | const iRect bounds = bounds_Widget(w); | 355 | const iRect bounds = bounds_Widget(w); |
356 | const iPrefs * prefs = prefs_App(); | 356 | const iPrefs * prefs = prefs_App(); |
357 | return iMini(iMax(50 * gap_UI, bounds.size.x - gap_UI * d->pageMargin * 2), | 357 | const int minWidth = 50 * gap_UI; /* lines must fit a word at least */ |
358 | const float adjust = iClamp((float) bounds.size.x / gap_UI / 11 - 12, | ||
359 | -2.0f, 10.0f); /* adapt to width */ | ||
360 | //printf("%f\n", adjust); fflush(stdout); | ||
361 | return iMini(iMax(minWidth, bounds.size.x - gap_UI * (d->pageMargin + adjust) * 2), | ||
358 | fontSize_UI * prefs->lineWidth * prefs->zoomPercent / 100); | 362 | fontSize_UI * prefs->lineWidth * prefs->zoomPercent / 100); |
359 | } | 363 | } |
360 | 364 | ||