Skip to content

Commit

Permalink
Fix bug with interpolation in %|| strings
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRadev committed Nov 13, 2012
1 parent f27d520 commit 0c4190c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions etc/examples/indent/strings.rb
@@ -0,0 +1,2 @@
command = %|#{file}|
settings.log.info("Returning: #{command}")
7 changes: 5 additions & 2 deletions indent/ruby.vim
Expand Up @@ -34,7 +34,7 @@ set cpo&vim


" Regex of syntax group names that are or delimit string or are comments. " Regex of syntax group names that are or delimit string or are comments.
let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' . let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
\ '\|String\|StringEscape\|ASCIICode' . \ '\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
\ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>' \ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>'


" Regex of syntax group names that are strings. " Regex of syntax group names that are strings.
Expand Down Expand Up @@ -498,12 +498,15 @@ function GetRubyIndent(...)


" If the previous line ended with [*+/.,-=], but wasn't a block ending, " If the previous line ended with [*+/.,-=], but wasn't a block ending,
" indent one extra level. " indent one extra level.
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\(}\|end\)') if s:Match(lnum, s:non_bracket_continuation_regex)
\ && !s:Match(lnum, '^\s*\(}\|end\)')
\ && !s:IsInStringOrComment(lnum, len(line))
if lnum == p_lnum if lnum == p_lnum
let ind = msl_ind + &sw let ind = msl_ind + &sw
else else
let ind = msl_ind let ind = msl_ind
endif endif
return ind
endif endif


" }}}2 " }}}2
Expand Down

0 comments on commit 0c4190c

Please sign in to comment.