Long-press highlights randomly large chunk of text

I’ve noticed that long-pressing in a field often highlights what seems like a randomly large amount of text (could be a few words or many lines). Any reason for this?

Give an example of a field with such a problem. Place the code in a code block.