Fix line-wise put before on an empty buffer

- Avoid special case in common 'Put' with trailing line break
- Handle special case for put after in 'PutAfterCaretCore'
- Add related CommandUtil and CommonOperations unit tests

Closes #1304