mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
(py-indent-right, py-outdent-left): fixed placement of point after
adjustments.
This commit is contained in:
parent
43ecf8ee58
commit
f2389a0b24
1 changed files with 22 additions and 16 deletions
|
|
@ -507,7 +507,9 @@ current line."
|
||||||
(if m
|
(if m
|
||||||
(list (min p m) (max p m) arg)
|
(list (min p m) (max p m) arg)
|
||||||
(list p m arg))))
|
(list p m arg))))
|
||||||
(let ((pos (- (point-max) (point)))
|
(let* ((dir (= (point) start))
|
||||||
|
(pos (if dir (point)
|
||||||
|
(- (point-max) (point))))
|
||||||
(end (save-excursion
|
(end (save-excursion
|
||||||
(goto-char (or end (1+ start)))
|
(goto-char (or end (1+ start)))
|
||||||
(and (not (bolp))
|
(and (not (bolp))
|
||||||
|
|
@ -528,7 +530,8 @@ current line."
|
||||||
(indent-to (+ col want))))
|
(indent-to (+ col want))))
|
||||||
(forward-line 1))
|
(forward-line 1))
|
||||||
(set-marker end nil))
|
(set-marker end nil))
|
||||||
(goto-char (- (point-max) pos))
|
(goto-char (if dir pos
|
||||||
|
(- (point-max) pos)))
|
||||||
(py-keep-region-active)))
|
(py-keep-region-active)))
|
||||||
|
|
||||||
(defun py-outdent-left (start end arg)
|
(defun py-outdent-left (start end arg)
|
||||||
|
|
@ -543,7 +546,9 @@ the current line."
|
||||||
(if m
|
(if m
|
||||||
(list (min p m) (max p m) arg)
|
(list (min p m) (max p m) arg)
|
||||||
(list p m arg))))
|
(list p m arg))))
|
||||||
(let ((pos (- (point-max) (point)))
|
(let* ((dir (= (point) start))
|
||||||
|
(pos (if dir (point)
|
||||||
|
(- (point-max) (point))))
|
||||||
(end (save-excursion
|
(end (save-excursion
|
||||||
(goto-char (or end (1+ start)))
|
(goto-char (or end (1+ start)))
|
||||||
(and (not (bolp))
|
(and (not (bolp))
|
||||||
|
|
@ -563,7 +568,8 @@ the current line."
|
||||||
(indent-to (- col want))))
|
(indent-to (- col want))))
|
||||||
(forward-line 1))
|
(forward-line 1))
|
||||||
(set-marker end nil))
|
(set-marker end nil))
|
||||||
(goto-char (- (point-max) pos))
|
(goto-char (if dir pos
|
||||||
|
(- (point-max) pos)))
|
||||||
(py-keep-region-active)))
|
(py-keep-region-active)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue