branch: externals/ement
commit 0fad92df965adc081808d80b4461d9dbe0cfb880
Author: Adam Porter <[email protected]>
Commit: Adam Porter <[email protected]>

    Change: (ement-room-flush-colors) Maintain point position
---
 README.org    | 1 +
 ement-room.el | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index 915f289c60..2d8d91a01d 100644
--- a/README.org
+++ b/README.org
@@ -305,6 +305,7 @@ Ement.el doesn't support encrypted rooms natively, but it 
can be used transparen
 + Name for direct rooms in directory buffers.
 + Editing a message from the compose buffer would be sent as a reply to the 
edited message.  (Fixes 
[[https://github.com/alphapapa/ement.el/issues/189][#189]].  Thanks to 
[[https://github.com/phil-s][Phil Sainty]] for reporting.)
 + Editing an already-edited message.  
([[https://github.com/alphapapa/ement.el/issues/226][#226]].  Thanks to 
[[https://github.com/phil-s][Phil Sainty]] for reporting.)
++ Command ~ement-room-flush-colors~ maintains point position.
 
 ** 0.12
 
diff --git a/ement-room.el b/ement-room.el
index 4f09075db8..ac77db1de6 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -1118,7 +1118,12 @@ when switching themes or adjusting `ement-prism' 
options."
   (dolist (buffer (buffer-list))
     (when (eq 'ement-room-mode (buffer-local-value 'major-mode buffer))
       (with-current-buffer buffer
-        (ewoc-refresh ement-ewoc))))
+        (let ((window-start (when (get-buffer-window buffer)
+                              (window-start (get-buffer-window buffer)))))
+          (save-excursion
+            (ewoc-refresh ement-ewoc))
+          (when window-start
+            (setf (window-start (get-buffer-window buffer)) window-start))))))
   ;; Flush notify-background-color colors.
   (cl-loop for (_id . session) in ement-sessions
            do (cl-loop for room in (ement-session-rooms session)

Reply via email to