File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ function! codefmt#clangformat#GetFormatter() abort
171171 let l: result = maktaba#syscall#Create (l: cmd ).WithStdin (l: input ).Call ()
172172 let l: formatted = split (l: result .stdout, " \n " )
173173
174- if l: supports_cursor
174+ if l: supports_cursor && ! ( line ( ' $ ' ) == 1 && getline ( 1 ) == ' ' )
175175 " With -cursor, the first line is a JSON object.
176176 let l: header = remove (l: formatted , 0 )
177177 call maktaba#buffer#Overwrite (1 , line (' $' ), l: formatted )
Original file line number Diff line number Diff line change @@ -181,3 +181,12 @@ current buffer.
181181
182182The -assume-filename arg passed above is also related, used by the clang-format
183183tool to detect any custom style rules particular to the current file.
184+
185+
186+ Bug #102. When the buffer is empty, clang-format does _not_ return a cursor
187+ position
188+
189+ @clear
190+ :call maktaba#error#TryCommand('FormatCode clang-format')
191+ ! clang-format -style file .*
192+ $ echo -n
You can’t perform that action at this time.
0 commit comments