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

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

[nongnu] elpa/iedit b9d97fa50e 095/301: Fix iedit-blank-occurrences brok


From: ELPA Syncer
Subject: [nongnu] elpa/iedit b9d97fa50e 095/301: Fix iedit-blank-occurrences broken with rectangles problem
Date: Mon, 10 Jan 2022 22:58:53 -0500 (EST)

branch: elpa/iedit
commit b9d97fa50ee96176021b0acbdd216cd39e853b97
Author: Victor Ren <victorhge@gmail.com>
Commit: Victor Ren <victorhge@gmail.com>

    Fix iedit-blank-occurrences broken with rectangles problem
    
    Fix iedit-blank-occurrences broken with rectangles problem
    
    Add .bzrignore
---
 .gitignore     |  3 ++-
 iedit-tests.el | 20 ++++++++++++++++++--
 iedit.el       | 11 +++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7c5214cc21..180f445a72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 *.elc
-
+.bzr
+.bzrignore
diff --git a/iedit-tests.el b/iedit-tests.el
index f4fb33d1da..761c60cc4d 100755
--- a/iedit-tests.el
+++ b/iedit-tests.el
@@ -2,9 +2,9 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2012-03-05 17:25:42 Victor Ren>
+;; Time-stamp: <2012-07-09 11:01:56 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
-;; Version: 0.94
+;; Version: 0.97
 ;; X-URL: http://www.emacswiki.org/emacs/Iedit
 
 ;; This file is not part of GNU Emacs, but it is distributed under
@@ -289,6 +289,22 @@ foo"
      (iedit-blank-occurrences)
      (should (string= (buffer-string) "        barfoo    ")))))
 
+(ert-deftest iedit-blank-occurrences-rectangle-test ()
+  "Test functions deal with the whole occurrences"
+  (with-iedit-test-fixture
+"foo
+ foo barfoo foo"
+   (lambda ()
+     (iedit-mode) ; turn off iedit
+     (goto-char 2)
+     (set-mark-command nil)
+     (forward-char 1)
+     (forward-line 1)
+     (iedit-rectangle-mode)
+     (iedit-blank-occurrences)
+     (should (string= (buffer-string) "f o
+  oo barfoo foo")))))
+
 (ert-deftest iedit-delete-occurrences-test ()
   "Test functions deal with the whole occurrences"
   (with-iedit-test-fixture
diff --git a/iedit.el b/iedit.el
index ba7c34b05a..bcfe4c0e06 100644
--- a/iedit.el
+++ b/iedit.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2010, 2011, 2012 Victor Ren
 
-;; Time-stamp: <2012-07-04 10:07:47 Victor Ren>
+;; Time-stamp: <2012-07-09 10:45:56 Victor Ren>
 ;; Author: Victor Ren <victorhge@gmail.com>
 ;; Keywords: occurrence region simultaneous rectangle refactoring
 ;; Version: 0.97
@@ -365,6 +365,7 @@ This is like `describe-bindings', but displays only Iedit 
keys."
 (or (assq 'iedit-mode minor-mode-map-alist)
     (setq minor-mode-map-alist
           (cons (cons 'iedit-mode iedit-mode-map) minor-mode-map-alist)))
+
 ;; Avoid to restore Iedit mode when restoring desktop
 (add-to-list 'desktop-minor-mode-handlers
              '(iedit-mode . nil))
@@ -896,8 +897,14 @@ This function preserves case."
   "Replace occurrences with blank spaces."
   (interactive "*")
   (let* ((ov (car iedit-occurrences-overlays))
+         (offset (- (point) (overlay-start ov)))
          (count (- (overlay-end ov) (overlay-start ov))))
-    (iedit-replace-occurrences (make-string count 32))))
+    (iedit-apply-on-occurrences
+     (lambda (beg end )
+       (delete-region beg end)
+       (goto-char beg)
+       (insert-and-inherit (make-string count 32))))
+    (goto-char (+ (overlay-start ov) offset))))
 
 (defun iedit-delete-occurrences()
   "Delete occurrences."



reply via email to

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