aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--misc/ruby-mode.el7
-rw-r--r--test/misc/test_ruby_mode.rb12
3 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f53d098de9..84dbdf41b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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