summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 15d81603..f7016ba4 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -245,7 +245,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
245 header2_FontId, 245 header2_FontId,
246 header3_FontId, 246 header3_FontId,
247 regular_FontId, 247 regular_FontId,
248 }; 248 };
249 static const int colors[max_GmLineType] = { 249 static const int colors[max_GmLineType] = {
250 gray75_ColorId, 250 gray75_ColorId,
251 gray75_ColorId, 251 gray75_ColorId,
@@ -255,7 +255,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
255 white_ColorId, 255 white_ColorId,
256 white_ColorId, 256 white_ColorId,
257 white_ColorId, 257 white_ColorId,
258 }; 258 };
259 static const int indents[max_GmLineType] = { 259 static const int indents[max_GmLineType] = {
260 5, 10, 5, 10, 0, 0, 0, 5 260 5, 10, 5, 10, 0, 0, 0, 5
261 }; 261 };
@@ -290,6 +290,7 @@ static void doLayout_GmDocument_(iGmDocument *d) {
290 } 290 }
291 while (nextSplit_Rangecc(&content, "\n", &line)) { 291 while (nextSplit_Rangecc(&content, "\n", &line)) {
292 iGmRun run; 292 iGmRun run;
293 run.flags = 0;
293 run.color = white_ColorId; 294 run.color = white_ColorId;
294 run.linkId = 0; 295 run.linkId = 0;
295 run.imageId = 0; 296 run.imageId = 0;
@@ -402,7 +403,9 @@ static void doLayout_GmDocument_(iGmDocument *d) {
402 isFirstText = iFalse; 403 isFirstText = iFalse;
403 } 404 }
404 iRangecc runLine = line; 405 iRangecc runLine = line;
405 /* Create one or more runs for this line. */ 406 /* Create one or more text runs for this line. */
407 run.flags |= startOfLine_GmRunFlag;
408 iAssert(!isEmpty_Range(&runLine)); /* must have something at this point */
406 while (!isEmpty_Range(&runLine)) { 409 while (!isEmpty_Range(&runLine)) {
407 /* Little bit of breathing space between wrapped lines. */ 410 /* Little bit of breathing space between wrapped lines. */
408 if ((type == text_GmLineType || type == quote_GmLineType || 411 if ((type == text_GmLineType || type == quote_GmLineType ||
@@ -427,10 +430,13 @@ static void doLayout_GmDocument_(iGmDocument *d) {
427 contPos = runLine.end; 430 contPos = runLine.end;
428 } 431 }
429 pushBack_Array(&d->layout, &run); 432 pushBack_Array(&d->layout, &run);
433 run.flags &= ~startOfLine_GmRunFlag;
430 runLine.start = contPos; 434 runLine.start = contPos;
431 trimStart_Rangecc(&runLine); 435 trimStart_Rangecc(&runLine);
432 pos.y += lineHeight_Text(run.font); 436 pos.y += lineHeight_Text(run.font);
433 } 437 }
438 /* Flag the end of line, too. */
439 ((iGmRun *) back_Array(&d->layout))->flags |= endOfLine_GmRunFlag;
434 /* Image content. */ 440 /* Image content. */
435 if (type == link_GmLineType) { 441 if (type == link_GmLineType) {
436 const size_t imgIndex = findLinkImage_GmDocument_(d, run.linkId); 442 const size_t imgIndex = findLinkImage_GmDocument_(d, run.linkId);