emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org 400d2d9 1/4: org-src: Use point instead of


From: ELPA Syncer
Subject: [elpa] externals-release/org 400d2d9 1/4: org-src: Use point instead of column for coords
Date: Sat, 1 May 2021 06:57:13 -0400 (EDT)

branch: externals-release/org
commit 400d2d9fd71ef3b4534e6722c3ee8aafb5b37f12
Author: TEC <tec@tecosaur.com>
Commit: Bastien Guerry <bzg@gnu.org>

    org-src: Use point instead of column for coords
    
    * lisp/org-src.el (org-src--coordinates)
    (org-src--goto-coordinates): Use point instead of column.
    
    Using a column-based approach fails to account for invisible regions
    or display overlays that change the number of columns: for example,
    showing a LaTeX \alpha as α.  In src edits which involve such
    structures, this causes the point to be shifted undesirably.  By using
    a point-based approach this issue does not occur.
---
 lisp/org-src.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 20acee4..3ed0ef6 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -327,8 +327,7 @@ a cons cell (LINE . COLUMN) or symbol `end'.  See also
      (cons (count-lines beg (line-beginning-position))
           ;; Column is relative to the end of line to avoid problems of
           ;; comma escaping or colons appended in front of the line.
-          (- (current-column)
-             (progn (end-of-line) (current-column)))))))
+          (- (point) (min end (line-end-position)))))))
 
 (defun org-src--goto-coordinates (coord beg end)
   "Move to coordinates COORD relatively to BEG and END.
@@ -341,9 +340,9 @@ which see.  BEG and END are buffer positions."
      (org-with-wide-buffer
       (goto-char beg)
       (forward-line (car coord))
-      (end-of-line)
-      (org-move-to-column (max (+ (current-column) (cdr coord)) 0))
-      (point)))))
+      (max (point)
+           (+ (min end (line-end-position))
+              (cdr coord)))))))
 
 (defun org-src--contents-area (datum)
   "Return contents boundaries of DATUM.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]