[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors d82e252 106/434: Don't let fake cursors s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors d82e252 106/434: Don't let fake cursors scroll the buffer |
Date: |
Sat, 7 Aug 2021 09:20:05 -0400 (EDT) |
branch: elpa/multiple-cursors
commit d82e252617d25cecdce6ac0ce8f99d3dff92bdfe
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Don't let fake cursors scroll the buffer
---
multiple-cursors-core.el | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 9345e74..4d8d652 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -140,15 +140,16 @@ up the proper environment, and then removing the cursor.
After executing the command, it sets up a new fake
cursor with updated info."
(mc/save-excursion
- (mc/for-each-fake-cursor
- (let ((id (overlay-get cursor 'mc-id))
- (annoying-arrows-mode nil)
- (smooth-scroll-margin 0))
- (mc/add-fake-cursor-to-undo-list
- (mc/pop-state-from-overlay cursor)
- (ignore-errors
- (mc/execute-command cmd)
- (mc/create-fake-cursor-at-point id)))))))
+ (mc/save-window-scroll
+ (mc/for-each-fake-cursor
+ (save-excursion
+ (let ((id (overlay-get cursor 'mc-id))
+ (annoying-arrows-mode nil))
+ (mc/add-fake-cursor-to-undo-list
+ (mc/pop-state-from-overlay cursor)
+ (ignore-errors
+ (mc/execute-command cmd)
+ (mc/create-fake-cursor-at-point id)))))))))
(defmacro mc/add-fake-cursor-to-undo-list (&rest forms)
"Make sure point is in the right place when undoing"
@@ -203,6 +204,18 @@ cursor with updated info."
(save-excursion ,@forms)
(mc/pop-state-from-overlay current-state)))
+(defmacro mc/save-window-scroll (&rest forms)
+ "Saves and restores the window scroll position"
+ `(let ((p (set-marker (make-marker) (point)))
+ (start (set-marker (make-marker) (window-start)))
+ (hscroll (window-hscroll)))
+ ,@forms
+ (goto-char p)
+ (set-window-start nil start)
+ (set-window-hscroll nil hscroll)
+ (set-marker p nil)
+ (set-marker start nil)))
+
(defun mc/prompt-for-inclusion-in-whitelist (original-command)
"Asks the user, then adds the command either to the once-list or the
all-list."
(let ((all-p (y-or-n-p (format "Do %S for all cursors?" original-command))))
- [nongnu] elpa/multiple-cursors 1075270 407/434: Added mc/interactive-repeating-commands (#303), (continued)
- [nongnu] elpa/multiple-cursors 1075270 407/434: Added mc/interactive-repeating-commands (#303), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 038815b 414/434: Make "no more matches found." user-error, fix #218, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d27870d 421/434: Load mc/list-file as late as possible, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fc6a6a7 422/434: Merge pull request #355 from flatwhatson/lazy-list-file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7763f4f 429/434: Load mc-cycle-cursors and mc-hide-unmatched-lines-mode after loading multiple-cursors-core, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a9d7764 431/434: Add option to disable bar-style fake cursors (#367), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 616fbdd 434/434: Document existing functions in Readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7ab8a8c 067/434: Better support for undo., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 608ceb4 069/434: Disable multiple-cursors-mode if there's only one cursor (the real one)., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 61280ae 100/434: autoload integration for package.el compatibility, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d82e252 106/434: Don't let fake cursors scroll the buffer,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors dc22766 108/434: Macros must be defined before they are used to be expanded properly, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7a655b0 117/434: Disable emacs-snapshot tests until it is in order., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 067063a 118/434: Split multiline kill-ring entry over cursors when num lines match, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors bdc4d9a 124/434: Add some more commands to default run-once/run-for-all lists., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0f54f98 133/434: Bump to 1.1.1 for bugfix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a0f771f 151/434: Include interactive commands for deselecting prev/next, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8a12e97 148/434: Mention region-bindings-mode in README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 19b1a83 160/434: Refactor mc/first-cursor-after and mc/last-cursor-before to not use extreme., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9ac7675 155/434: Added tests for mc/cycle-forward and mc/cycle-backward with their new looping behaviour, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dce196c 167/434: Merge pull request #28 from gvol/master, ELPA Syncer, 2021/08/07