diff options
Diffstat (limited to 'src/ui/text.c')
-rw-r--r-- | src/ui/text.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ui/text.c b/src/ui/text.c index 0a8386e4..639d8f13 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -1433,6 +1433,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
1433 | iBool isFirst = iTrue; | 1433 | iBool isFirst = iTrue; |
1434 | const iBool checkHitPoint = wrap && !isEqual_I2(wrap->hitPoint, zero_I2()); | 1434 | const iBool checkHitPoint = wrap && !isEqual_I2(wrap->hitPoint, zero_I2()); |
1435 | const iBool checkHitChar = wrap && wrap->hitChar; | 1435 | const iBool checkHitChar = wrap && wrap->hitChar; |
1436 | iBool wasCharHit = iFalse; | ||
1436 | while (!isEmpty_Range(&wrapRuns)) { | 1437 | while (!isEmpty_Range(&wrapRuns)) { |
1437 | if (isFirst) { | 1438 | if (isFirst) { |
1438 | isFirst = iFalse; | 1439 | isFirst = iFalse; |
@@ -1452,9 +1453,10 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
1452 | for (size_t runIndex = wrapRuns.start; runIndex < wrapRuns.end; runIndex++) { | 1453 | for (size_t runIndex = wrapRuns.start; runIndex < wrapRuns.end; runIndex++) { |
1453 | const iAttributedRun *run = at_Array(&attrText.runs, runIndex); | 1454 | const iAttributedRun *run = at_Array(&attrText.runs, runIndex); |
1454 | if (run->flags.isLineBreak) { | 1455 | if (run->flags.isLineBreak) { |
1455 | if (checkHitChar) { | 1456 | if (checkHitChar && !wasCharHit) { |
1456 | if (wrap->hitChar == sourcePtr_AttributedText_(&attrText, run->logical.start)) { | 1457 | if (wrap->hitChar == sourcePtr_AttributedText_(&attrText, run->logical.start)) { |
1457 | wrap->hitAdvance_out = init_I2(wrapAdvance, yCursor); | 1458 | wrap->hitAdvance_out = init_I2(wrapAdvance, yCursor); |
1459 | wasCharHit = iTrue; | ||
1458 | } | 1460 | } |
1459 | } | 1461 | } |
1460 | wrapPosRange.end = run->logical.start; | 1462 | wrapPosRange.end = run->logical.start; |
@@ -1479,9 +1481,10 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
1479 | if (logPos < wrapPosRange.start || logPos >= wrapPosRange.end) { | 1481 | if (logPos < wrapPosRange.start || logPos >= wrapPosRange.end) { |
1480 | continue; | 1482 | continue; |
1481 | } | 1483 | } |
1482 | if (checkHitChar) { | 1484 | if (checkHitChar && !wasCharHit) { |
1483 | if (wrap->hitChar == sourcePtr_AttributedText_(&attrText, logPos)) { | 1485 | if (wrap->hitChar == sourcePtr_AttributedText_(&attrText, logPos)) { |
1484 | wrap->hitAdvance_out = init_I2(wrapAdvance, yCursor); | 1486 | wrap->hitAdvance_out = init_I2(wrapAdvance, yCursor); |
1487 | wasCharHit = iTrue; | ||
1485 | } | 1488 | } |
1486 | } | 1489 | } |
1487 | /* Check if the hit point is on the left side of this line. */ | 1490 | /* Check if the hit point is on the left side of this line. */ |