These commands should operate on full lines that are part of the selection, rather than only parts of the lines at the start and end of the selection.
Operating on only parts of the start/end lines can break those lines.
Fixes: commit af729fad Fixes: commit 6d775e7f Fixes: commit 6f539d95