Skip to content

Commit f16cb1d

Browse files
committed
compile escape_string
1 parent d24f14c commit f16cb1d

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
@@ -5581,12 +5581,14 @@ function! s:Compiler.compile_curlynameexpr(node) abort
55815581
endfunction
55825582

55835583
function! s:Compiler.escape_string(str) abort
5584-
let m = {"\n": '\n', "\t": '\t', "\r": '\r'}
55855584
let out = '"'
5586-
for i in range(len(a:str))
5587-
let c = a:str[i]
5588-
if has_key(m, c)
5589-
let out .= m[c]
5585+
for c in split(a:str, '\zs')
5586+
if c ==# "\n"
5587+
let out .= '\n'
5588+
elseif c ==# "\t"
5589+
let out .= '\t'
5590+
elseif c ==# "\r"
5591+
let out .= '\r'
55905592
else
55915593
let out .= c
55925594
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)