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

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

[elpa] externals/elpa 38971d3 66/71: Fix #367: don't let M-x fill-paragr


From: João Távora
Subject: [elpa] externals/elpa 38971d3 66/71: Fix #367: don't let M-x fill-paragraph break didChange
Date: Wed, 16 Dec 2020 11:42:27 -0500 (EST)

branch: externals/elpa
commit 38971d3c1d647ab6ad839c3b8585394ea8e53b54
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix #367: don't let M-x fill-paragraph break didChange
    
    M-x fill-paragraph represents some paragraph-fillling changes very
    summarily.  Filling
    
        1 // foo
        2 bar
    
    Into
    
        1 // foo bar
    
    Only makes two changes: a deletion of the "// " and a replacement of a
    newline with a space character.  The second change fooled Eglot's fix
    for #259, by making a change similar to the one it is made to detect
    and correct.  That fix should taget things that happen on the same
    line, this not being one of those things.
    
    * eglot.el (eglot--after-change): Only apply fix to #259 if
    case-fiddling happens on same line.
---
 eglot.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/eglot.el b/eglot.el
index b0bd213..aa89ae9 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1745,10 +1745,15 @@ Records BEG, END and PRE-CHANGE-LENGTH locally."
      ;; github#259: With `upcase-word' or somesuch,
      ;; `before-change-functions' always records the whole word's
      ;; `beg' and `end'.  Not only is this longer than needed but
-     ;; conflicts with the args received here.  Detect this using
-     ;; markers recorded earlier and `pre-change-len', then fix it.
+     ;; conflicts with the args received here, which encompass just
+     ;; the parts of the word that changed (if any).  We detect this
+     ;; using markers recorded earlier and at looking
+     ;; `pre-change-len'.  We also ensure that the before bounds
+     ;; indeed belong to the same line (if we don't, we get could get
+     ;; #367).
      (when (and (= b-end b-end-marker) (= b-beg b-beg-marker)
-                (not (zerop pre-change-length)))
+                (not (zerop pre-change-length))
+                (= (plist-get lsp-beg :line) (plist-get lsp-end :line)))
        (setq lsp-end (eglot--pos-to-lsp-position end)
              lsp-beg (eglot--pos-to-lsp-position beg)))
      (setcar eglot--recent-changes



reply via email to

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