You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the the option 'InsertNewlineAtEOF: true' clang-format returns a string that will have a newline followed by a space, compared to no newline at then end when it is switched off. This newline will cause an empty line at the end of the file, which is unwanted.
Proposed fix
I am not well versed in Vimscript, so my current approach is to trim all outputs returned in the system function:
@@ -39,6 +39,9 @@ function! s:system(str, ...) abort
\ vimproc#system(command, input, a:2) : system(command, input)
endif
+ " if clang-format option InsertNewlineAtEOF is set, there is a newline + space at the end+ " of the output, which we don't want as this leads to additional newlines in vim+ let output = trim(output, " \n", 2)
return output
endfunction
An alternative would be to only trim the output in the format_ranges function, as system is used in other places as well.
The text was updated successfully, but these errors were encountered:
argh, just saw that this is the same issue that #120 tries to address. Though my proposed patch tries to solve it at a different position in the plugin.
-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213, 1840, 1846-1847, 2110-2112, 2121
Observation
When using the the option 'InsertNewlineAtEOF: true' clang-format returns a string that will have a newline followed by a space, compared to no newline at then end when it is switched off. This newline will cause an empty line at the end of the file, which is unwanted.
Proposed fix
I am not well versed in Vimscript, so my current approach is to trim all outputs returned in the system function:
An alternative would be to only trim the output in the format_ranges function, as system is used in other places as well.
The text was updated successfully, but these errors were encountered: