diff --git a/src/gmdocument.c b/src/gmdocument.c index fd1de3b2..a9bea74c 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c @@ -2731,7 +2731,8 @@ iRangecc findLoc_GmRun(const iGmRun *d, iInt2 pos) { } iRangecc loc; iWrapText wt = { .text = d->text, - .maxWidth = drawBoundWidth_GmRun(d), + .mode = anyCharacter_WrapTextMode, + .maxWidth = isJustified_GmRun(d) ? drawBoundWidth_GmRun(d) : 0, .justify = isJustified_GmRun(d), .hitPoint = init_I2(x, 0) }; measure_WrapText(&wt, d->font); diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 8e160fd3..4ad2bb20 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -1168,8 +1168,8 @@ struct Impl_DrawContext {  static int measureAdvanceToLoc_(const iGmRun *run, const char *end) { iWrapText wt = { .text = run->text, - .mode = word_WrapTextMode, - .maxWidth = iAbsi(drawBoundWidth_GmRun(run)), + .mode = anyCharacter_WrapTextMode, + .maxWidth = isJustified_GmRun(run) ? iAbsi(drawBoundWidth_GmRun(run)) : 0, .justify = isJustified_GmRun(run), .hitChar = end }; measure_WrapText(&wt, run->font);