Browse Source

Fix cursor position after changing bullet types

Carsten Dominik 15 years ago
parent
commit
b2343cef32
2 changed files with 6 additions and 2 deletions
  1. 4 0
      lisp/ChangeLog
  2. 2 2
      lisp/org-list.el

+ 4 - 0
lisp/ChangeLog

@@ -1,3 +1,7 @@
+2010-03-17  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-list.el (org-fix-bullet-type): Improve cursor positioning.
+
 2010-03-15  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-adaptive-fill-regexp-backup): New variable.

+ 2 - 2
lisp/org-list.el

@@ -852,7 +852,7 @@ Also, fix the indentation."
   (interactive)
   (unless (org-at-item-p) (error "This is not a list"))
   (let ((line (org-current-line))
-	(col (current-column))
+	(chars-from-eol (- (point-at-eol) (point)))
 	(ind (current-indentation))
 	ind1 bullet oldbullet)
     ;; find where this list begins
@@ -883,7 +883,7 @@ Also, fix the indentation."
 	  (org-shift-item-indentation (- (length bullet)
 					 (length oldbullet))))))
     (org-goto-line line)
-    (org-move-to-column col)
+    (goto-char (max (point-at-bol) (- (point-at-eol) chars-from-eol)))
     (if (string-match "[0-9]" bullet)
 	(org-renumber-ordered-list 1))))