Skip to content

Commit

Permalink
Merge pull request #1 from Nitrodist/fix-newline-formatting
Browse files Browse the repository at this point in the history
Fix newlines not being properly escaped
  • Loading branch information
Nitrodist authored Mar 21, 2024
2 parents ba7d1dd + b904c00 commit 62bae8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autoload/rufo.vim
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ function! s:format(start_line, end_line) abort
silent exec l:buffer_number . 'bdelete'
endif

let l:selection = join(getline(a:start_line, a:end_line), "\n")
let l:lines = getline(a:start_line, a:end_line)
let l:escaped_lines = map(l:lines, 'substitute(v:val, "\\\\n", "\\\\\\\\n", "g")')
let l:selection = join(l:escaped_lines, "\n")
let l:out = systemlist('echo ' . shellescape(l:selection) . '| rufo')
return [s:formatting_failed(v:shell_error), l:out]
endf
Expand Down

0 comments on commit 62bae8d

Please sign in to comment.