Multiline formatting hotkeys do not recognize

Start with a 3-lines post:

line 1
line 2 <- trailing space after the "2"
line 3

Now select lines 2 and 3, then press Command+B to mark all 3 lines “bold”. The result is:


The formatting action does not recognize the trailing space and thus the resulting formatting is broken.

Should be easy to fix by only wrapping the trimmed version of the text and not touching the trailing spaces.