Permalink
Browse files

Fix bug with interpolation in %|| strings

  • Loading branch information...
1 parent f27d520 commit 0c4190c1c88e25fcd2994709da8c27f22dd697ec @AndrewRadev AndrewRadev committed Nov 13, 2012
Showing with 7 additions and 2 deletions.
  1. +2 −0 etc/examples/indent/strings.rb
  2. +5 −2 indent/ruby.vim
@@ -0,0 +1,2 @@
+command = %|#{file}|
+settings.log.info("Returning: #{command}")
View
@@ -34,7 +34,7 @@ set cpo&vim
" Regex of syntax group names that are or delimit string or are comments.
let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
- \ '\|String\|StringEscape\|ASCIICode' .
+ \ '\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
\ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>'
" Regex of syntax group names that are strings.
@@ -498,12 +498,15 @@ function GetRubyIndent(...)
" If the previous line ended with [*+/.,-=], but wasn't a block ending,
" 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
let ind = msl_ind + &sw
else
let ind = msl_ind
endif
+ return ind
endif
" }}}2

0 comments on commit 0c4190c

Please sign in to comment.