While working on issue #2855 I noticed that we can't simply do clear | string replace \e\[3J "" because the string replace will append an unwanted newline. The solution in this case is simple enough: just use a command substitution to eat the newline. But it got me wondering if perhaps we should only append a newline to all but the final line of output unless reading from stdin and the final line of input ended with a newline. Note that doing something like string replace x y axxb | some_command would still send a newline terminated string to some_command.
This change would make mistakes involving piping arbitrary strings through string less likely. On the other hand it's an exception to the general rule that string writes "lines" (defined as ending with a newline).