nytimes/Emphasis

Quoted text causes highlighting to become greedy

su opened this issue · 1 comments

su commented

If you click to select a sentence that contains a quote, and that quote terminates the sentence, the highlighting process doesn't stop until it hits the end of a following "plain" sentence.

This case doesn't exist in the demo document, so we have to construct it.

Steps:

  • Take the current first paragraph ("The morning after…") and tack it onto the end of the second ("We are not so unlucky"…), combining them into a new single paragraph.
  • Activate Emphasis.
  • Select the new first paragraph.
  • Select the second sentence, beginning "When I remember…"
  • The highlight will blow past the quote ending that sentence, including the next one in the highlight, at which point it stops:

highlight-1

If we happen to have consecutive terminal quotes, the process repeats until a "plain" sentence is reached. Rearranging the demo document again:

highlight-2

su commented

I also just realized that the greediness goes in both directions.
If you try to select the plain sentence, the highlighting will go past its beginning, to grab the preceding quote-containing sentence.