Skip to content

Commit 21720f3

Browse files
committed
compile escape_string
1 parent 0bdc2ba commit 21720f3

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

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