From 0c4190c1c88e25fcd2994709da8c27f22dd697ec Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Tue, 13 Nov 2012 11:45:07 +0100 Subject: [PATCH] Fix bug with interpolation in %|| strings --- etc/examples/indent/strings.rb | 2 ++ indent/ruby.vim | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 etc/examples/indent/strings.rb diff --git a/etc/examples/indent/strings.rb b/etc/examples/indent/strings.rb new file mode 100644 index 00000000..d69f806a --- /dev/null +++ b/etc/examples/indent/strings.rb @@ -0,0 +1,2 @@ +command = %|#{file}| +settings.log.info("Returning: #{command}") diff --git a/indent/ruby.vim b/indent/ruby.vim index e9953252..8bbbbbb0 100644 --- a/indent/ruby.vim +++ b/indent/ruby.vim @@ -34,7 +34,7 @@ set cpo&vim " Regex of syntax group names that are or delimit string or are comments. let s:syng_strcom = '\' " 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