Skip to content

Commit 187a917

Browse files
committed
compile escape_string
1 parent b38f1f5 commit 187a917

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

autoload/vimlparser.vim

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5575,12 +5575,14 @@ function! s:Compiler.compile_curlynameexpr(node) abort
55755575
endfunction
55765576

55775577
function! s:Compiler.escape_string(str) abort
5578-
let m = {"\n": '\n', "\t": '\t', "\r": '\r'}
55795578
let out = '"'
5580-
for i in range(len(a:str))
5581-
let c = a:str[i]
5582-
if has_key(m, c)
5583-
let out .= m[c]
5579+
for c in split(a:str, '\zs')
5580+
if c ==# "\n"
5581+
let out .= '\n'
5582+
elseif c ==# "\t"
5583+
let out .= '\t'
5584+
elseif c ==# "\r"
5585+
let out .= '\r'
55845586
else
55855587
let out .= c
55865588
endif

go/vimlparser.go

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)