diff options
| author | Micah Chalmer <micah@micahchalmer.net> | 2014-02-22 03:36:11 -0500 |
|---|---|---|
| committer | Micah Chalmer <micah@micahchalmer.net> | 2014-02-22 22:55:30 -0500 |
| commit | 08006607ab96e1b4bdfd12ddb43d143d28763e76 (patch) | |
| tree | d874aa5f54f0142a7b2c91f6b8557afe349aa5d1 /rust-mode-tests.el | |
| parent | bee96e838de53fa7aee7cfc9ea689fcad3816725 (diff) | |
| download | rust-mode-08006607ab96e1b4bdfd12ddb43d143d28763e76.tar.gz | |
Emacs: stay at the correct position when indenting
When indenting a non-blank line, stay at the same cursor position
relative to the content after indenting.
Diffstat (limited to 'rust-mode-tests.el')
| -rw-r--r-- | rust-mode-tests.el | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index e8be519..c0543b6 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -488,6 +488,26 @@ struct Foo { } " rust-test-region-string rust-test-motion-string + rust-test-indent-motion-string + " +fn blank_line(arg:int) -> bool { + +} + +fn indenting_closing_brace() { + if(true) { +} +} + +fn indenting_middle_of_line() { + if(true) { + push_me_out(); +} else { + pull_me_back_in(); +} +} +" + ;; Symbol -> (line column) rust-test-positions-alist '((start-of-fn1 (2 0)) (start-of-fn1-middle-of-line (2 15)) @@ -502,7 +522,17 @@ struct Foo { (middle-of-fn3 (16 4)) (middle-of-struct (21 10)) (before-start-of-struct (19 0)) - (after-end-of-struct (23 0)))) + (after-end-of-struct (23 0)) + (blank-line-indent-start (3 0)) + (blank-line-indent-target (3 4)) + (closing-brace-indent-start (8 1)) + (closing-brace-indent-target (8 5)) + (middle-push-indent-start (13 2)) + (middle-push-indent-target (13 9)) + (after-whitespace-indent-start (13 1)) + (after-whitespace-indent-target (13 8)) + (middle-pull-indent-start (15 19)) + (middle-pull-indent-target (15 12)))) (defun rust-get-buffer-pos (pos-symbol) "Get buffer position from POS-SYMBOL. @@ -664,3 +694,38 @@ All positions are position symbols found in `rust-test-positions-alist'." 'middle-of-struct 'before-start-of-struct 'after-end-of-struct #'mark-defun)) + +(ert-deftest indent-line-blank-line-motion () + (rust-test-motion + rust-test-indent-motion-string + 'blank-line-indent-start + 'blank-line-indent-target + #'indent-for-tab-command)) + +(ert-deftest indent-line-closing-brace-motion () + (rust-test-motion + rust-test-indent-motion-string + 'closing-brace-indent-start + 'closing-brace-indent-target + #'indent-for-tab-command)) + +(ert-deftest indent-line-middle-push-motion () + (rust-test-motion + rust-test-indent-motion-string + 'middle-push-indent-start + 'middle-push-indent-target + #'indent-for-tab-command)) + +(ert-deftest indent-line-after-whitespace-motion () + (rust-test-motion + rust-test-indent-motion-string + 'after-whitespace-indent-start + 'after-whitespace-indent-target + #'indent-for-tab-command)) + +(ert-deftest indent-line-middle-pull-motion () + (rust-test-motion + rust-test-indent-motion-string + 'middle-pull-indent-start + 'middle-pull-indent-target + #'indent-for-tab-command)) |
