From ee5aa3641d9ded14f88653a46dbb9f420fd284b8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 13 Mar 2025 13:35:54 +0200 Subject: [PATCH] Allow control of indicating empty rectangular selections * lisp/rect.el (rectangle-indicate-zero-width-rectangle): New user option. (rectangle--highlight-for-redisplay): Use it to decide whether to indicate empty rectangles on display. (Bug#16403) * etc/NEWS: Announce the feature. (cherry picked from commit cecaec20e7ad525719d7d05233f1e6e2ba6a1475) --- lisp/rect.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/rect.el b/lisp/rect.el index 4aa5a8ad4d1..1211b3ccd56 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -446,6 +446,11 @@ With a prefix (or a FILL) argument, also fill too short lines." :version "25.1" :type 'boolean) +(defcustom rectangle-indicate-zero-width-rectangle t + "If non-nil, make zero-width rectangles visible on display." + :version "31.1" + :type 'boolean) + (defun rectangle--string-preview () (when rectangle-preview (let ((str (minibuffer-contents))) @@ -946,7 +951,8 @@ Ignores `line-move-visual'." (overlay-put ol 'after-string str)))) ((overlay-get ol 'after-string) (overlay-put ol 'after-string nil))) - (when (and (= leftcol rightcol) (display-graphic-p)) + (when (and (= leftcol rightcol) (display-graphic-p) + rectangle-indicate-zero-width-rectangle) ;; Make zero-width rectangles visible! (overlay-put ol 'after-string (concat (propertize -- 2.39.5