Skip to content
This repository
Browse code

Fix bug with interpolation in %|| strings

  • Loading branch information...
commit 0c4190c1c88e25fcd2994709da8c27f22dd697ec 1 parent f27d520
Andrew Radev AndrewRadev authored

Showing 2 changed files with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 0  etc/examples/indent/strings.rb
  2. +5 2 indent/ruby.vim
2  etc/examples/indent/strings.rb
... ... @@ -0,0 +1,2 @@
  1 +command = %|#{file}|
  2 +settings.log.info("Returning: #{command}")
7 indent/ruby.vim
@@ -34,7 +34,7 @@ set cpo&vim
34 34
35 35 " Regex of syntax group names that are or delimit string or are comments.
36 36 let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
37   - \ '\|String\|StringEscape\|ASCIICode' .
  37 + \ '\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
38 38 \ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>'
39 39
40 40 " Regex of syntax group names that are strings.
@@ -498,12 +498,15 @@ function GetRubyIndent(...)
498 498
499 499 " If the previous line ended with [*+/.,-=], but wasn't a block ending,
500 500 " indent one extra level.
501   - if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\(}\|end\)')
  501 + if s:Match(lnum, s:non_bracket_continuation_regex)
  502 + \ && !s:Match(lnum, '^\s*\(}\|end\)')
  503 + \ && !s:IsInStringOrComment(lnum, len(line))
502 504 if lnum == p_lnum
503 505 let ind = msl_ind + &sw
504 506 else
505 507 let ind = msl_ind
506 508 endif
  509 + return ind
507 510 endif
508 511
509 512 " }}}2

0 comments on commit 0c4190c

Please sign in to comment.
Something went wrong with that request. Please try again.