Actually, the correct behavior of text fields in general.
In this case, you see two words on different lines, because the second one is larger than the container, so you see a line break, and you are trying to use up arrow to select "foo".
But, as you say in the question, there is a white space after "foo", so you should use the left arrow to select it.
Imagine the same case, but with a full width text box, you will only try to use the left arrow . Here, only the style is changed, not the behavior for this particular content.
nanocv
source share