Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4ea01db

Browse files
committed
Do not modify for leading space
1 parent 75711d4 commit 4ea01db

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

third_party/txt/src/txt/paragraph_txt.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ bool ParagraphTxt::ComputeBidiRuns(std::vector<BidiRun>* result) {
419419
// TODO(garyq): Handle this in the text editor caret code instead at layout
420420
// level.
421421
bool has_trailing_whitespace = false;
422-
bool is_leading = false; // True if the whitespace is a leading whitespace.
423422
int32_t bidi_run_start, bidi_run_length;
424423
if (bidi_run_count > 1) {
425424
ubidi_getVisualRun(bidi.get(), bidi_run_count - 1, &bidi_run_start,
@@ -437,11 +436,10 @@ bool ParagraphTxt::ComputeBidiRuns(std::vector<BidiRun>* result) {
437436
ubidi_getVisualRun(bidi.get(), bidi_run_count - 2,
438437
&second_last_bidi_run_start,
439438
&second_last_bidi_run_length);
440-
if (bidi_run_start < second_last_bidi_run_start) {
441-
is_leading = true;
439+
if (bidi_run_start >= second_last_bidi_run_start) {
440+
has_trailing_whitespace = true;
441+
bidi_run_count--;
442442
}
443-
has_trailing_whitespace = true;
444-
bidi_run_count--;
445443
}
446444
}
447445
}
@@ -484,9 +482,6 @@ bool ParagraphTxt::ComputeBidiRuns(std::vector<BidiRun>* result) {
484482
// Attach the final trailing whitespace as part of this run.
485483
if (has_trailing_whitespace && bidi_run_index == bidi_run_count - 1) {
486484
bidi_run_length++;
487-
if (is_leading) {
488-
bidi_run_start--;
489-
}
490485
}
491486

492487
size_t bidi_run_end = bidi_run_start + bidi_run_length;

0 commit comments

Comments
 (0)