diff options
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 3 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 8eadf018a67..340c689f02e 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -1690,7 +1690,8 @@ See `add-log-current-defun-function'." | |||
| 1690 | (when (eq (char-before) ?\}) | 1690 | (when (eq (char-before) ?\}) |
| 1691 | (delete-char -1) | 1691 | (delete-char -1) |
| 1692 | (when (save-excursion | 1692 | (when (save-excursion |
| 1693 | (skip-chars-backward " \t") | 1693 | (let ((n (skip-chars-backward " \t"))) |
| 1694 | (if (< n 0) (delete-char (- n)))) | ||
| 1694 | (not (bolp))) | 1695 | (not (bolp))) |
| 1695 | (insert "\n")) | 1696 | (insert "\n")) |
| 1696 | (insert "end") | 1697 | (insert "end") |
diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index efbe012427f..83fcdd8aa85 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el | |||
| @@ -369,7 +369,11 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 369 | (ruby-with-temp-buffer "foo {|b|\n}" | 369 | (ruby-with-temp-buffer "foo {|b|\n}" |
| 370 | (beginning-of-line) | 370 | (beginning-of-line) |
| 371 | (ruby-toggle-block) | 371 | (ruby-toggle-block) |
| 372 | (should (string= "foo do |b|\nend" (buffer-string))))) | 372 | (should (string= "foo do |b|\nend" (buffer-string)))) |
| 373 | (ruby-with-temp-buffer "foo {|b| b }" | ||
| 374 | (beginning-of-line) | ||
| 375 | (ruby-toggle-block) | ||
| 376 | (should (string= "foo do |b|\n b\nend" (buffer-string))))) | ||
| 373 | 377 | ||
| 374 | (ert-deftest ruby-toggle-block-to-brace () | 378 | (ert-deftest ruby-toggle-block-to-brace () |
| 375 | (let ((pairs '((17 . "foo { |b| b + 2 }") | 379 | (let ((pairs '((17 . "foo { |b| b + 2 }") |