Subject: bug#16403: 24.3.50; Rectangular selection visually disturbing

From: Bastien <[email-masked]>
Date: Fri, 10 Jan 2014 20:58:33 +0100

Daniel Colascione <[email-masked]> writes:

> On 01/09/2014 02:15 AM, Ivan Kalyaev wrote:
>> When I press <C-x SPS> to start vertical selection lines of text shift to the
>> right because empty selection is represented with a line symbol.
>>
>> It looked like font rendering glitch at first. The jerky motion is disturbing.
>>
>> How do you think the visual experience could be made better?
>>
>> For comparison, vim selects the starting character right away.
>
> I usually use Emacs in a window system. In a tty, yes, this behavior
> looks bad. We should do something about it.

I suggest these fixes (see patch attached):

- don't display an after-string overlay in tty;

- Let C-x SPC sends this message to the user:
  "Mark active (rectangle mode)"
  instead of just "Mark active"

Let me know what you think.

diff --git a/lisp/rect.el b/lisp/rect.el
index f1f0b8d..3d890b5 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -444,7 +444,8 @@ Activates the region if needed.  Only lasts until the region is deactivated."
               (lambda () (rectangle-mark-mode -1)))
     (unless (region-active-p)
       (push-mark)
-      (activate-mark))))
+      (activate-mark)
+      (message "Mark set (rectangle mode)"))))
 
 (defun rectangle--extract-region (orig &optional delete)
   (if (not rectangle-mark-mode)
@@ -553,10 +554,10 @@ Activates the region if needed.  Only lasts until the region is deactivated."
                     (overlay-put ol 'after-string str))))
                ((overlay-get ol 'after-string)
                 (overlay-put ol 'after-string nil)))
-              (when (= leftcol rightcol)
+              (when (and (= leftcol rightcol) (window-system))
                 ;; Make zero-width rectangles visible!
-                (overlay-put ol 'after-string
-                             (concat (propertize " "
+		(overlay-put ol 'after-string
+			     (concat (propertize " "
                                                  'face '(region (:height 0.2)))
                                      (overlay-get ol 'after-string))))
               (push ol nrol)

-- 
 Bastien