Kaydet (Commit) f2389a0b authored tarafından Barry Warsaw's avatar Barry Warsaw

(py-indent-right, py-outdent-left): fixed placement of point after

adjustments.
üst 43ecf8ee
...@@ -507,13 +507,15 @@ current line." ...@@ -507,13 +507,15 @@ 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))
(end (save-excursion (pos (if dir (point)
(goto-char (or end (1+ start))) (- (point-max) (point))))
(and (not (bolp)) (end (save-excursion
(forward-line 1)) (goto-char (or end (1+ start)))
(set-marker (make-marker) (point)))) (and (not (bolp))
col want indent) (forward-line 1))
(set-marker (make-marker) (point))))
col want indent)
(goto-char start) (goto-char start)
(beginning-of-line) (beginning-of-line)
(unwind-protect (unwind-protect
...@@ -528,7 +530,8 @@ current line." ...@@ -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,13 +546,15 @@ the current line." ...@@ -543,13 +546,15 @@ 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))
(end (save-excursion (pos (if dir (point)
(goto-char (or end (1+ start))) (- (point-max) (point))))
(and (not (bolp)) (end (save-excursion
(forward-line 1)) (goto-char (or end (1+ start)))
(set-marker (make-marker) (point)))) (and (not (bolp))
col want) (forward-line 1))
(set-marker (make-marker) (point))))
col want)
(goto-char start) (goto-char start)
(beginning-of-line) (beginning-of-line)
(unwind-protect (unwind-protect
...@@ -563,7 +568,8 @@ the current line." ...@@ -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)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment