diff options
| author | Jakub Ječmínek | 2025-06-29 23:56:13 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-08-02 17:14:50 +0300 |
| commit | e52ed1b5d1531e7dc15f3f8ddf7042b0a7e71f50 (patch) | |
| tree | cb803625c3e3e292ac8773812ed437141a06460e /test/lisp/progmodes/python-tests.el | |
| parent | 2846dd8842cc6d6e9ff6395a4822456f130ce4a8 (diff) | |
| download | emacs-e52ed1b5d1531e7dc15f3f8ddf7042b0a7e71f50.tar.gz emacs-e52ed1b5d1531e7dc15f3f8ddf7042b0a7e71f50.zip | |
Improve region deletion handling in python.el
* lisp/progmodes/python.el (python-indent-dedent-line-backspace):
Delete the text in the region if Transient Mark mode is enabled,
the mark is active, and prefix arg is 1. (Bug#48695)
* test/lisp/progmodes/python-tests.el
(python-indent-dedent-line-backspace-4): Add new test.
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
| -rw-r--r-- | test/lisp/progmodes/python-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 2c00f47d82c..d65ef39abb4 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -3780,6 +3780,24 @@ if x: | |||
| 3780 | (pos-bol) (pos-eol)) | 3780 | (pos-bol) (pos-eol)) |
| 3781 | "abcdef"))))) | 3781 | "abcdef"))))) |
| 3782 | 3782 | ||
| 3783 | (ert-deftest python-indent-dedent-line-backspace-4 () | ||
| 3784 | "Delete the text in the region instead of de-indentation. Bug#48695." | ||
| 3785 | (dolist (test '((1 4) (2 0))) | ||
| 3786 | (python-tests-with-temp-buffer | ||
| 3787 | " | ||
| 3788 | if True: | ||
| 3789 | x () | ||
| 3790 | if False: | ||
| 3791 | " | ||
| 3792 | (let ((current-prefix-arg (list (car test)))) | ||
| 3793 | (python-tests-look-at "if False:") | ||
| 3794 | (end-of-line) | ||
| 3795 | (transient-mark-mode) | ||
| 3796 | (set-mark (point)) | ||
| 3797 | (backward-word 2) | ||
| 3798 | (call-interactively #'python-indent-dedent-line-backspace) | ||
| 3799 | (should (= (current-indentation) (cadr test))))))) | ||
| 3800 | |||
| 3783 | (ert-deftest python-bob-infloop-avoid () | 3801 | (ert-deftest python-bob-infloop-avoid () |
| 3784 | "Test that strings at BOB don't confuse syntax analysis. Bug#24905" | 3802 | "Test that strings at BOB don't confuse syntax analysis. Bug#24905" |
| 3785 | (python-tests-with-temp-buffer | 3803 | (python-tests-with-temp-buffer |