GNU bug report logs - #16403
24.3.50; Rectangular selection visually disturbing

Previous Next

Package: emacs;

Reported by: Ivan Kalyaev <ivan.kalyaev <at> gmail.com>

Date: Thu, 9 Jan 2014 10:16:01 UTC

Severity: normal

Found in version 24.3.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: dmoncayo <at> gmail.com, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: michael_heerdegen <at> web.de, 16403 <at> debbugs.gnu.org
Subject: bug#16403: Rectangular selection visually disturbing
Date: Sun, 09 Mar 2025 12:14:34 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,  Eli Zaretskii
>  <eliz <at> gnu.org>,  16403 <at> debbugs.gnu.org
> Date: Wed, 05 Mar 2025 16:20:40 -0500
> 
> >> > that thin vertical line.  I find it convenient (tho I agree that the
> >> > small motion is bar jarring), but that's a question of taste.
> >>
> >> It is a bit more than only convenient: for commands like
> >> `string-rectangle' or `rectangle-number-lines' it is an important guide
> >> visualizing what one will get.
> >
> > FWIW: As I said, I dislike the current visual effect of shifting the
> > text.  And I would definitely prefer _not_ to see _any_ visual
> > indication of a zero-columns rectangle, if that indication entails
> > such a visual effect.  That's why I'm asking for a way to configure
> > the behavior I prefer.
> 
> In the short term, I think adding a config var to disable the small
> space is probably the best option.  Patch welcome.
> In the longer term, it might be worthwhile to consider adding a delay,
> i.e. a zero-width rectangle would start being shown as "zero width" but
> after a short idle time we'd add the small space to make it more
> visually obvious.  It would help avoid the small movement that
> occurs between the time you `C-x RET` and the time you start moving
> the cursor while still offering the convenient visual feedback to those
> willing to wait a little.

Here's a patch with the "short-term" solution.  Does it give good
results?  Should I install it (with the necessary NEWS addition)?"

diff --git a/lisp/rect.el b/lisp/rect.el
index be99a33..e630f80 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -456,6 +456,11 @@ rectangle-preview
   :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)))
@@ -960,7 +965,8 @@ rectangle--highlight-for-redisplay
                         (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




This bug report was last modified 124 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.