Add dealing with newlines for editor to 5.1-to-6.0
Created by: bbodenmiller
backport of https://github.com/gitlabhq/gitlabhq/commit/2d681c0d1ed14bf23c041aa04fa3e77caceda9a1
Created by: bbodenmiller
backport of https://github.com/gitlabhq/gitlabhq/commit/2d681c0d1ed14bf23c041aa04fa3e77caceda9a1