summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 12:41:45 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-20 12:41:45 +0300
commitd41d2e4f68ac990cff543f5e5cffa098714e0de7 (patch)
tree20552412064ec5526fe2ceaae535899dad588248 /src
parent060666530935528610fceeadb7ee1b613587c888 (diff)
GmDocument: Adjusting narrow margin collapse
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 14065fa1..80053565 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -337,11 +337,12 @@ static void alignDecoration_GmRun_(iGmRun *run, iBool isCentered) {
337} 337}
338 338
339static void doLayout_GmDocument_(iGmDocument *d) { 339static void doLayout_GmDocument_(iGmDocument *d) {
340 const iPrefs *prefs = prefs_App(); 340 const iPrefs *prefs = prefs_App();
341 const iBool isMono = isForcedMonospace_GmDocument_(d); 341 const iBool isMono = isForcedMonospace_GmDocument_(d);
342 const iBool isNarrow = d->size.x < 90 * gap_Text; 342 const iBool isNarrow = d->size.x < 90 * gap_Text;
343 const iBool isVeryNarrow = d->size.x <= 75 * gap_Text; 343 const iBool isVeryNarrow = d->size.x <= 70 * gap_Text;
344 const iBool isDarkBg = isDark_GmDocumentTheme( 344 const iBool isExtremelyNarrow = d->size.x <= 60 * gap_Text;
345 const iBool isDarkBg = isDark_GmDocumentTheme(
345 isDark_ColorTheme(colorTheme_App()) ? prefs->docThemeDark : prefs->docThemeLight); 346 isDark_ColorTheme(colorTheme_App()) ? prefs->docThemeDark : prefs->docThemeLight);
346 /* TODO: Collect these parameters into a GmTheme. */ 347 /* TODO: Collect these parameters into a GmTheme. */
347 const int fonts[max_GmLineType] = { 348 const int fonts[max_GmLineType] = {
@@ -370,7 +371,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
370 float indents[max_GmLineType] = { 371 float indents[max_GmLineType] = {
371 5, 10, 5, isNarrow ? 5 : 10, 0, 0, 0, 5 372 5, 10, 5, isNarrow ? 5 : 10, 0, 0, 0, 5
372 }; 373 };
373 if (isVeryNarrow) { 374 if (isExtremelyNarrow) {
374 /* Further reduce the margins. */ 375 /* Further reduce the margins. */
375 indents[text_GmLineType] -= 5; 376 indents[text_GmLineType] -= 5;
376 indents[bullet_GmLineType] -= 5; 377 indents[bullet_GmLineType] -= 5;