Selectively remove empty line after line change

gdaniel answered the bulk of question with this comment:

Every time you type Enter (the return character) the editor
creates a new paragraph <p>my content</p>, the alternative is to
type Shift+Enter so that the editor creates a
line break (<br/>) instead.

Note that the the <br /> and </p> tags are added via wpautop, one of the display filters attached to the wp_content filter.

Thewp_content filter is not applied to the content being viewed within the Text editor, so the <br /> and </p> tags added by wpautop are not visible there. Instead, the raw text is displayed so the formatting is just a result of any newlines being present:

Soft return
Soft return
Soft return

Normal return

Normal return

Normal return

The Visual editor does not show HTML tags, but the browser’s developer tools can be used to inspect the Visual editor’s HTML content, where the above would be rendered as:

<p>Soft return<br>
Soft return<br>
Soft return</p>
<p>Normal return</p>
<p>Normal return</p>
<p>Normal return</p>