Skip to content

Commit 1f44b3f

Browse files
committed
Use ASCII cancel to flag invalid projections
1 parent 39b6df2 commit 1f44b3f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

autoload/rails.vim

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,12 +1621,12 @@ function! s:readable_params(...) dict abort
16211621
endfunction
16221622

16231623
function! s:expand_url(url, params) abort
1624-
let params = extend({'controller': "\1", 'action': "\1", 'format': "\1"}, a:params, 'keep')
1624+
let params = extend({'controller': "\030", 'action': "\030", 'format': "\030"}, a:params, 'keep')
16251625
let url = substitute(a:url, '\%(/\(\w\+\)/\)\=\zs[:*]\(\h\w*\)',
1626-
\ '\=strftime(get(s:split(get(params,rails#singularize(submatch(1))."_".submatch(2),get(params,submatch(2),1))), 0, "\1"))', 'g')
1627-
let url = s:gsub(url, '\([^()]*'."\1".'[^()]*\)', '')
1626+
\ '\=strftime(get(s:split(get(params,rails#singularize(submatch(1))."_".submatch(2),get(params,submatch(2),1))), 0, "\030"))', 'g')
1627+
let url = s:gsub(url, '\([^()]*'."\030".'[^()]*\)', '')
16281628
let url = s:gsub(url, '[()]', '')
1629-
if url !~# "\1"
1629+
if url !~# "\030"
16301630
return url
16311631
else
16321632
return ''
@@ -4689,30 +4689,30 @@ function! s:expand_placeholder(placeholder, expansions) abort
46894689
if has_key(a:expansions, get(transforms, 0, '}'))
46904690
let value = a:expansions[remove(transforms, 0)]
46914691
else
4692-
let value = get(a:expansions, 'match', "\001")
4692+
let value = get(a:expansions, 'match', "\030")
46934693
endif
46944694
for transform in transforms
46954695
if !has_key(s:transformations, transform)
4696-
return "\001"
4696+
return "\030"
46974697
endif
46984698
let value = s:transformations[transform](value, a:expansions)
4699-
if value =~# "\001"
4700-
return "\001"
4699+
if value =~# "\030"
4700+
return "\030"
47014701
endif
47024702
endfor
47034703
return value
47044704
endfunction
47054705

47064706
function! s:expand_placeholders(string, placeholders, ...) abort
47074707
if type(a:string) ==# type({}) || type(a:string) == type([])
4708-
return filter(map(copy(a:string), 's:expand_placeholders(v:val, a:placeholders, 1)'), 'type(v:val) !=# type("") || v:val !~# "\001"')
4708+
return filter(map(copy(a:string), 's:expand_placeholders(v:val, a:placeholders, 1)'), 'type(v:val) !=# type("") || v:val !~# "\030"')
47094709
elseif type(a:string) !=# type('')
47104710
return a:string
47114711
endif
47124712
let ph = extend({'%': '%'}, a:placeholders)
47134713
let value = substitute(a:string, '{[^{}]*}', '\=s:expand_placeholder(submatch(0), ph)', 'g')
4714-
let value = substitute(value, '%\([^: ]\)', '\=get(ph, submatch(1), "\001")', 'g')
4715-
return !a:0 && value =~# "\001" ? '' : value
4714+
let value = substitute(value, '%\([^: ]\)', '\=get(ph, submatch(1), "\030")', 'g')
4715+
return !a:0 && value =~# "[\001-\006\016-\037]" ? '' : value
47164716
endfunction
47174717

47184718
function! s:readable_projected_with_raw(key, ...) dict abort

0 commit comments

Comments
 (0)