X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ccb75d72bd02885109c7c339c1f72a393a9d3d22..08974112ae68aefba658a8516c8faa3374edc924:/lisp/rect.el diff --git a/lisp/rect.el b/lisp/rect.el index e9a4f4574e..8803a47215 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -370,7 +370,7 @@ no text on the right side of the rectangle." "Delete all whitespace following a specified column in each line. The left edge of the rectangle specifies the position in each line at which whitespace deletion should begin. On each line in the -rectangle, all continuous whitespace starting at that column is deleted. +rectangle, all contiguous whitespace starting at that column is deleted. When called from a program the rectangle's corners are START and END. With a prefix (or a FILL) argument, also fill too short lines." @@ -476,10 +476,15 @@ Called from a program, takes three args; START, END and STRING." #'rectangle--string-erase-preview nil t) (add-hook 'post-command-hook #'rectangle--string-preview nil t)) - (read-string (format "String rectangle (default %s): " - (or (car string-rectangle-history) "")) - nil 'string-rectangle-history + (read-string (format "String rectangle (default %s): " + (or (car string-rectangle-history) "")) + nil 'string-rectangle-history (car string-rectangle-history))))))) + ;; If we undo this change, we want to have the point back where we + ;; are now, and not after the first line in the rectangle (which is + ;; the first line to be changed by the following command). + (unless (eq buffer-undo-list t) + (push (point) buffer-undo-list)) (goto-char (apply-on-rectangle 'string-rectangle-line start end string t))) @@ -815,7 +820,7 @@ Ignores `line-move-visual'." (overlay-put ol 'after-string nil))) ((< mright rightcol) ;`rightcol' is past EOL. (let ((str (rectangle--space-to rightcol))) - (put-text-property 0 (length str) 'face 'rectangle-preview str) + (put-text-property 0 (length str) 'face 'region str) ;; If cursor happens to be here, draw it at the right place. (rectangle--place-cursor leftcol left str) (overlay-put ol 'after-string str))) @@ -827,7 +832,7 @@ Ignores `line-move-visual'." (overlay-put ol 'after-string nil) (goto-char right) (let ((str (rectangle--space-to rightcol))) - (put-text-property 0 (length str) 'face 'rectangle-preview str) + (put-text-property 0 (length str) 'face 'region str) (when (= left right) (rectangle--place-cursor leftcol left str)) (overlay-put ol 'after-string str)))) @@ -837,7 +842,7 @@ Ignores `line-move-visual'." ;; Make zero-width rectangles visible! (overlay-put ol 'after-string (concat (propertize " " - 'face '(rectangle-preview (:height 0.2))) + 'face '(region (:height 0.2))) (overlay-get ol 'after-string)))) (push ol nrol))) start end))