diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-09 14:06:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-09 14:06:15 +0000 |
commit | 862048e28d26112af1e67205cfd1c16564590bce (patch) | |
tree | 6de342236d0e592f0c7c2af18064df12088bc45c | |
parent | 4df71924e47bc0da8bbc3a08f814c48350131585 (diff) | |
download | ruby-862048e28d26112af1e67205cfd1c16564590bce.tar.gz |
* misc/ruby-mode.el (ruby-parse-partial): fix indent after aref.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | misc/ruby-mode.el | 7 | ||||
-rw-r--r-- | test/misc/test_ruby_mode.rb | 12 |
3 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Wed Mar 9 23:06:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * misc/ruby-mode.el (ruby-parse-partial): fix indent after aref. + Wed Mar 9 12:50:24 2011 Aaron Patterson <aaron@tenderlovemaking.com> * ext/psych/lib/psych/visitors/yaml_tree.rb: Rescue exceptions when diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 1b16c68366..19b2518e42 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -602,7 +602,12 @@ The variable ruby-indent-level controls the amount of indentation. ) ((looking-at "[])}]") (if (ruby-deep-indent-paren-p (matching-paren (char-after)) - (save-excursion (ruby-backward-sexp) (point))) + (if nest + (1- (cdr (nth 0 nest))) + (save-excursion + (forward-char) + (ruby-backward-sexp) + (point)))) (setq depth (cdr (car pcol)) pcol (cdr pcol)) (setq depth (1- depth))) (setq nest (cdr nest)) diff --git a/test/misc/test_ruby_mode.rb b/test/misc/test_ruby_mode.rb index 64786b3408..6ac3f2e26a 100644 --- a/test/misc/test_ruby_mode.rb +++ b/test/misc/test_ruby_mode.rb @@ -132,5 +132,17 @@ class TestRubyMode | end |') end + + def test_array_literal + assert_indent(' + |begin + | a[b] + |end + |', ' + |begin + | a[b] + | end + |') + end end end if TestRubyMode::EMACS |