summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c7
-rw-r--r--src/gmdocument.c4
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/util.c2
5 files changed, 14 insertions, 1 deletions
diff --git a/src/app.c b/src/app.c
index 32255675..16cf14d4 100644
--- a/src/app.c
+++ b/src/app.c
@@ -214,6 +214,7 @@ static iString *serializePrefs_App_(const iApp *d) {
214 appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs); 214 appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs);
215 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); 215 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth);
216 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph); 216 appendFormat_String(str, "prefs.biglede.changed arg:%d\n", d->prefs.bigFirstParagraph);
217 appendFormat_String(str, "prefs.plaintext.wrap.changed arg:%d\n", d->prefs.plainTextWrap);
217 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon); 218 appendFormat_String(str, "prefs.sideicon.changed arg:%d\n", d->prefs.sideIcon);
218 appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs); 219 appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs);
219 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0); 220 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0);
@@ -1581,6 +1582,11 @@ iBool handleCommand_App(const char *cmd) {
1581 postCommand_App("document.layout.changed"); 1582 postCommand_App("document.layout.changed");
1582 return iTrue; 1583 return iTrue;
1583 } 1584 }
1585 else if (equal_Command(cmd, "prefs.plaintext.wrap.changed")) {
1586 d->prefs.plainTextWrap = arg_Command(cmd) != 0;
1587 postCommand_App("document.layout.changed");
1588 return iTrue;
1589 }
1584 else if (equal_Command(cmd, "prefs.sideicon.changed")) { 1590 else if (equal_Command(cmd, "prefs.sideicon.changed")) {
1585 d->prefs.sideIcon = arg_Command(cmd) != 0; 1591 d->prefs.sideIcon = arg_Command(cmd) != 0;
1586 postRefresh_App(); 1592 postRefresh_App();
@@ -1815,6 +1821,7 @@ iBool handleCommand_App(const char *cmd) {
1815 selected_WidgetFlag, 1821 selected_WidgetFlag,
1816 iTrue); 1822 iTrue);
1817 setToggle_Widget(findChild_Widget(dlg, "prefs.biglede"), d->prefs.bigFirstParagraph); 1823 setToggle_Widget(findChild_Widget(dlg, "prefs.biglede"), d->prefs.bigFirstParagraph);
1824 setToggle_Widget(findChild_Widget(dlg, "prefs.plaintext.wrap"), d->prefs.plainTextWrap);
1818 setToggle_Widget(findChild_Widget(dlg, "prefs.sideicon"), d->prefs.sideIcon); 1825 setToggle_Widget(findChild_Widget(dlg, "prefs.sideicon"), d->prefs.sideIcon);
1819 setToggle_Widget(findChild_Widget(dlg, "prefs.centershort"), d->prefs.centerShortDocs); 1826 setToggle_Widget(findChild_Widget(dlg, "prefs.centershort"), d->prefs.centerShortDocs);
1820 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark); 1827 updateColorThemeButton_(findChild_Widget(dlg, "prefs.doctheme.dark"), d->prefs.docThemeDark);
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 17c44105..f8e5b8ad 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -602,11 +602,13 @@ static void doLayout_GmDocument_(iGmDocument *d) {
602 } 602 }
603 rightMargin = (type == text_GmLineType || type == bullet_GmLineType || 603 rightMargin = (type == text_GmLineType || type == bullet_GmLineType ||
604 type == quote_GmLineType ? 4 : 0); 604 type == quote_GmLineType ? 4 : 0);
605 const iBool isWordWrapped =
606 (d->format == plainText_GmDocumentFormat ? prefs->plainTextWrap : !isPreformat);
605 iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */ 607 iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */
606 while (!isEmpty_Range(&runLine)) { 608 while (!isEmpty_Range(&runLine)) {
607 run.bounds.pos = addX_I2(pos, indent * gap_Text); 609 run.bounds.pos = addX_I2(pos, indent * gap_Text);
610 const int avail = isWordWrapped ? d->size.x - run.bounds.pos.x - rightMargin * gap_Text : 0;
608 const char *contPos; 611 const char *contPos;
609 const int avail = isPreformat ? 0 : (d->size.x - run.bounds.pos.x - rightMargin * gap_Text);
610 const iInt2 dims = tryAdvance_Text(run.font, runLine, avail, &contPos); 612 const iInt2 dims = tryAdvance_Text(run.font, runLine, avail, &contPos);
611 iChangeFlags(run.flags, wide_GmRunFlag, (isPreformat && dims.x > d->size.x)); 613 iChangeFlags(run.flags, wide_GmRunFlag, (isPreformat && dims.x > d->size.x));
612 run.bounds.size.x = iMax(avail, dims.x); /* Extends to the right edge for selection. */ 614 run.bounds.size.x = iMax(avail, dims.x); /* Extends to the right edge for selection. */
diff --git a/src/prefs.c b/src/prefs.c
index b4b3b32c..5aba8359 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -47,6 +47,7 @@ void init_Prefs(iPrefs *d) {
47 d->bigFirstParagraph = iTrue; 47 d->bigFirstParagraph = iTrue;
48 d->quoteIcon = iTrue; 48 d->quoteIcon = iTrue;
49 d->centerShortDocs = iTrue; 49 d->centerShortDocs = iTrue;
50 d->plainTextWrap = iTrue;
50 d->docThemeDark = colorfulDark_GmDocumentTheme; 51 d->docThemeDark = colorfulDark_GmDocumentTheme;
51 d->docThemeLight = white_GmDocumentTheme; 52 d->docThemeLight = white_GmDocumentTheme;
52 d->saturation = 1.0f; 53 d->saturation = 1.0f;
diff --git a/src/prefs.h b/src/prefs.h
index 56cef52c..50dd1969 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -67,6 +67,7 @@ struct Impl_Prefs {
67 iBool bigFirstParagraph; 67 iBool bigFirstParagraph;
68 iBool quoteIcon; 68 iBool quoteIcon;
69 iBool centerShortDocs; 69 iBool centerShortDocs;
70 iBool plainTextWrap;
70 /* Colors */ 71 /* Colors */
71 enum iGmDocumentTheme docThemeDark; 72 enum iGmDocumentTheme docThemeDark;
72 enum iGmDocumentTheme docThemeLight; 73 enum iGmDocumentTheme docThemeLight;
diff --git a/src/ui/util.c b/src/ui/util.c
index 05858b52..04dbe190 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1864,6 +1864,8 @@ iWidget *makePreferences_Widget(void) {
1864 addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 1864 addChildFlags_Widget(values, iClob(quote), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
1865 addChild_Widget(headings, iClob(makeHeading_Widget("Big 1st paragaph:"))); 1865 addChild_Widget(headings, iClob(makeHeading_Widget("Big 1st paragaph:")));
1866 addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede"))); 1866 addChild_Widget(values, iClob(makeToggle_Widget("prefs.biglede")));
1867 addChild_Widget(headings, iClob(makeHeading_Widget("Wrap plain text:")));
1868 addChild_Widget(values, iClob(makeToggle_Widget("prefs.plaintext.wrap")));
1867 } 1869 }
1868 /* Network. */ { 1870 /* Network. */ {
1869 appendTwoColumnPage_(tabs, "Network", '5', &headings, &values); 1871 appendTwoColumnPage_(tabs, "Network", '5', &headings, &values);