Fix formatting for multiline selections with the toolbar.
Review Request #13250 — Created Sept. 1, 2023 and submitted
This fixes our formatting for multiline selections with the toolbar. Before,
the formatting symbols would only be put at the beginning of the first line and
end of the last line, but now we put them at the beginning and end of each line
in the selection. This also fixes a bug for multiline selections that had
a smaller line length for the first line than the rest of the lines. Applying
formatting to these types of selections would lead to an infinite loop.
Tested bold, italic, strikethrough and code formatting with various single
line and multiline, selections and no selections.