unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
@ 2014-06-15 19:17 Andrea Rossetti
  2014-06-15 22:09 ` Stephen Berman
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Andrea Rossetti @ 2014-06-15 19:17 UTC (permalink / raw)
  To: 17788


  Hello, I found a minor bug in ruler mode, here is
a recipe to reproduce it:

 - start emacs -Q
 - M-x ruler-mode RET
 - click S-<mouse-1> on the column 10 of the ruler, this will set a left
   margin
 - you will see the ruler has two column indicators in red colour:
   "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
 - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
 - drag the indicator horizontally; indicator will follow the mouse as expected
 - continue dragging slightly diagonally (for example in West-South-West
   direction); as soon as you drag the mouse out of the grey ruler area,
   you will see that the indicator "hops" left of about 10 columns
 
  I realize the explanation may be hard to follow because it involves
mouse dragging, so I prepared a small explicative image, it's available
here:

https://raw.githubusercontent.com/thesoftwarebin/the-emacs-software-bin/master/emacs-bugs/ruler-mode-diagonal-drag-issue.png
  
  May someone please confirm if the above recipe seems to be reproducible.

  Thanks in advance for your attention and your patience in reading,
kindest regards. 

  Andrea



In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7600
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $LANG: ITA
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  diff-auto-refine-mode: t
  gnus-undo-mode: t
  show-paren-mode: t
  server-mode: t
  recentf-mode: t
  cua-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 19:17 bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally Andrea Rossetti
@ 2014-06-15 22:09 ` Stephen Berman
  2014-06-15 23:06   ` Andrea Rossetti
  2014-06-16  7:11 ` martin rudalics
  2020-09-09 11:47 ` Lars Ingebrigtsen
  2 siblings, 1 reply; 13+ messages in thread
From: Stephen Berman @ 2014-06-15 22:09 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 17788

On Sun, 15 Jun 2014 21:17:26 +0200 Andrea Rossetti <andrea.rossetti@gmail.com> wrote:

>   Hello, I found a minor bug in ruler mode, here is
> a recipe to reproduce it:
>
>  - start emacs -Q
>  - M-x ruler-mode RET
>  - click S-<mouse-1> on the column 10 of the ruler, this will set a left
>    margin
>  - you will see the ruler has two column indicators in red colour:
>    "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
>  - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
>  - drag the indicator horizontally; indicator will follow the mouse as expected
>  - continue dragging slightly diagonally (for example in West-South-West
>    direction); as soon as you drag the mouse out of the grey ruler area,
>    you will see that the indicator "hops" left of about 10 columns
>  
>   I realize the explanation may be hard to follow because it involves
> mouse dragging, so I prepared a small explicative image, it's available
> here:
>
> https://raw.githubusercontent.com/thesoftwarebin/the-emacs-software-bin/master/emacs-bugs/ruler-mode-diagonal-drag-issue.png
>   
>   May someone please confirm if the above recipe seems to be reproducible.
>
>   Thanks in advance for your attention and your patience in reading,
> kindest regards. 
>
>   Andrea
>
>
>
> In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7600)
>  of 2013-03-17 on MARVIN
> Windowing system distributor `Microsoft Corp.', version 6.1.7600

I can reproduce your observation on GNU Emacs 24.3.91.10
(x86_64-suse-linux-gnu, GTK+ Version 3.10.4) of 2014-06-13 on rosalinde.
I can add these observations:

(1) I see # jump whenever the mouse pointer is moved off the ruler while
    holding down mouse-2, regardless of which direction you drag in (but
    conditioned on the following point).

(2) If you don't set the left margin, I see # jump as follows:
    - If you drag from # straight down (due south), # jumps three
      columns to the left. 
    - If you drag from # southeast by one character, # jumps two columns
      to the left.
    - If you drag from # southeast by two characters, # jumps one column
      to the left.
    - If you drag from # southeast by more than two characters, # does
      not jump to the left.
    - If you drag from # southwest, # slides (but doesn't jump) to
      whatever column you stop the drag on.  Moreover, once you drag #
      southwest, you can slide # anywhere while holding mouse-2 with the
      mouse pointer in the text area, just like when it is on the rule.

(3) If you set the left margin, the the number of columns jumped by
    dragging due south equals (margin width + 3), if I'm not mistaken.

Steve Berman





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 22:09 ` Stephen Berman
@ 2014-06-15 23:06   ` Andrea Rossetti
  2014-06-15 23:14     ` Andrea Rossetti
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Andrea Rossetti @ 2014-06-15 23:06 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 17788

[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]


  Thanks Stephen for having tested at your side.

> (1) I see # jump whenever the mouse pointer is moved off the ruler while
>     holding down mouse-2, regardless of which direction you drag in
>     ...

  Yes, (1) is the same for me.

> (2) If you don't set the left margin, I see # jump as follows:
>     - If you drag from # straight down (due south), # jumps three
>       columns to the left. 
>     - If you drag from # southeast by one character, # jumps two columns
>       to the left.
>     - If you drag from # southeast by two characters, # jumps one column
>       to the left.
>     - If you drag from # southeast by more than two characters, # does
>       not jump to the left.
>     - If you drag from # southwest, # slides (but doesn't jump) to
>       whatever column you stop the drag on.  Moreover, once you drag #
>       southwest, you can slide # anywhere while holding mouse-2 with the
>       mouse pointer in the text area, just like when it is on the rule.
>

  I can't replicate any of the cases in (2); I always get 1 column hop.

> (3) If you set the left margin, the the number of columns jumped by
>     dragging due south equals (margin width + 3), if I'm not mistaken.

  In my setup I see the indicator jumps left for (margin width + 1)
columns. I'm afraid some other window parameters may be involved,
for example:

  - if you have a leftside fringe (I have it)
  - if you have a leftside scrollbar (I only have it rightside)
  - (maybe?) if your window manager sets thick window borders
    (I have just 3-4 pixel borders)

  I wrote a (quite rough) patch that seems to resolve all "hop"
problems on my installation. May I please ask if anyone has time
and patience to try the patch and report if it provides some benefit.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-bug-17788-ruler-mode-indicators-hops-left.patch --]
[-- Type: text/x-patch, Size: 3305 bytes --]

From a9e5f6508e0ef3f582b78d174ac173ac1c403585 Mon Sep 17 00:00:00 2001
From: Andrea Rossetti <andrea.rossetti@gmail.com>
Date: Mon, 16 Jun 2014 00:28:34 +0200
Subject: [PATCH]  bug#17788: ruler-mode indicators "hops" left

---
 lisp/ruler-mode.el | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 9e32a2f..4cbcf63 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -302,13 +302,17 @@ or remove a tab stop.  \\[ruler-mode-toggle-show-tab-stops] or
   (let ((edges (window-edges)))
     (- (nth 2 edges) (nth 0 edges))))
 
-(defsubst ruler-mode-window-col (n)
+(defsubst ruler-mode-window-col (start-or-end-event)
   "Return a column number relative to the selected window.
-N is a column number relative to selected frame."
-  (- n
-     (car (window-edges))
-     (or (car (window-margins)) 0)
-     (fringe-columns 'left)
+START-OR-END-EVENT is the start point or end point of a mouse
+click or mouse drag event.
+                                                                  
+See also: `event-start', `event-end', `posn-col-row', `posn-area'.
+"                                                                 
+  (- (car (posn-col-row start-or-end-event))                      
+     (if (eq (posn-area start) 'header-line)                      
+         (+ (or (car (window-margins)) 0) (fringe-columns 'left)) 
+       0)                                                         
      (scroll-bar-columns 'left)))
 \f
 (defun ruler-mode-mouse-set-left-margin (start-event)
@@ -372,7 +376,7 @@ dragging.  See also the variable `ruler-mode-dragged-symbol'."
          col newc oldc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row start)))
+      (setq col  (ruler-mode-window-col start)
             newc (+ col (window-hscroll)))
       (and
        (>= col 0) (< col (window-width))
@@ -455,7 +459,7 @@ Called on each mouse motion event START-EVENT."
          col newc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row end)))
+      (setq col  (ruler-mode-window-col end)
             newc (+ col (window-hscroll)))
       (when (and (>= col 0) (< col (window-width)))
         (set ruler-mode-dragged-symbol newc)))))
@@ -471,7 +475,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (not (member ts tab-stop-list))
@@ -491,7 +495,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (member ts tab-stop-list)
-- 
1.8.1.msysgit.1


[-- Attachment #3: Type: text/plain, Size: 49 bytes --]


  Thanks in advance, kindest regards.

  Andrea

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 23:06   ` Andrea Rossetti
@ 2014-06-15 23:14     ` Andrea Rossetti
  2014-06-16  7:11     ` martin rudalics
  2014-06-16 10:16     ` Stephen Berman
  2 siblings, 0 replies; 13+ messages in thread
From: Andrea Rossetti @ 2014-06-15 23:14 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 17788

>   I wrote a (quite rough) patch...

To create the patch I downloaded recent sources
from git://git.savannah.gnu.org/emacs.git
and built my changes on top of last commit
(4e9e12229d5482523589b7ab75d17bca12383330
Sun Jun 15 22:49:10 2014 +0200).






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 19:17 bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally Andrea Rossetti
  2014-06-15 22:09 ` Stephen Berman
@ 2014-06-16  7:11 ` martin rudalics
  2020-09-09 11:47 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 13+ messages in thread
From: martin rudalics @ 2014-06-16  7:11 UTC (permalink / raw)
  To: Andrea Rossetti, 17788

 >    Hello, I found a minor bug in ruler mode, here is
 > a recipe to reproduce it:
 >
 >   - start emacs -Q
 >   - M-x ruler-mode RET
 >   - click S-<mouse-1> on the column 10 of the ruler, this will set a left
 >     margin
 >   - you will see the ruler has two column indicators in red colour:
 >     "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
 >   - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
 >   - drag the indicator horizontally; indicator will follow the mouse as expected
 >   - continue dragging slightly diagonally (for example in West-South-West
 >     direction); as soon as you drag the mouse out of the grey ruler area,
 >     you will see that the indicator "hops" left of about 10 columns

I can reproduce the behavior now.  Thanks.

martin





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 23:06   ` Andrea Rossetti
  2014-06-15 23:14     ` Andrea Rossetti
@ 2014-06-16  7:11     ` martin rudalics
  2014-06-16 20:26       ` Andrea Rossetti
  2014-06-16 10:16     ` Stephen Berman
  2 siblings, 1 reply; 13+ messages in thread
From: martin rudalics @ 2014-06-16  7:11 UTC (permalink / raw)
  To: Andrea Rossetti, Stephen Berman; +Cc: 17788

 >    I wrote a (quite rough) patch that seems to resolve all "hop"
 > problems on my installation. May I please ask if anyone has time
 > and patience to try the patch and report if it provides some benefit.

After applying your earlier patch this won't apply any more.  Kindly
provide a new one against the present trunk.

Thanks, martin





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 23:06   ` Andrea Rossetti
  2014-06-15 23:14     ` Andrea Rossetti
  2014-06-16  7:11     ` martin rudalics
@ 2014-06-16 10:16     ` Stephen Berman
  2014-06-16 19:03       ` Andrea Rossetti
  2 siblings, 1 reply; 13+ messages in thread
From: Stephen Berman @ 2014-06-16 10:16 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 17788

On Mon, 16 Jun 2014 01:06:55 +0200 Andrea Rossetti <andrea.rossetti@gmail.com> wrote:

>   Thanks Stephen for having tested at your side.
>
>> (1) I see # jump whenever the mouse pointer is moved off the ruler while
>>     holding down mouse-2, regardless of which direction you drag in
>>     ...
>
>   Yes, (1) is the same for me.
>
>> (2) If you don't set the left margin, I see # jump as follows:
>>     - If you drag from # straight down (due south), # jumps three
>>       columns to the left. 
>>     - If you drag from # southeast by one character, # jumps two columns
>>       to the left.
>>     - If you drag from # southeast by two characters, # jumps one column
>>       to the left.
>>     - If you drag from # southeast by more than two characters, # does
>>       not jump to the left.
>>     - If you drag from # southwest, # slides (but doesn't jump) to
>>       whatever column you stop the drag on.  Moreover, once you drag #
>>       southwest, you can slide # anywhere while holding mouse-2 with the
>>       mouse pointer in the text area, just like when it is on the rule.
>>
>
>   I can't replicate any of the cases in (2); I always get 1 column hop.
>
>> (3) If you set the left margin, the the number of columns jumped by
>>     dragging due south equals (margin width + 3), if I'm not mistaken.
>
>   In my setup I see the indicator jumps left for (margin width + 1)
> columns. I'm afraid some other window parameters may be involved,
> for example:
>
>   - if you have a leftside fringe (I have it)

Me too (as well as right fringe).

>   - if you have a leftside scrollbar (I only have it rightside)

I do indeed that the scroll bar on the left (it's also a non-toolkit
scroll bar, FWIW).

>   - (maybe?) if your window manager sets thick window borders
>     (I have just 3-4 pixel borders)

Do you mean X-window borders, i.e., Emacs frame borders?  If so, I have
one pixel wide borders.

>   I wrote a (quite rough) patch that seems to resolve all "hop"
> problems on my installation. May I please ask if anyone has time
> and patience to try the patch and report if it provides some benefit.

With your patch, I still get a jump of # when I drag the mouse pointer
down out of the ruler, but now only by two columns to the left,
regardless of whether I set the left margin or not.

> -(defsubst ruler-mode-window-col (n)
> +(defsubst ruler-mode-window-col (start-or-end-event)
>    "Return a column number relative to the selected window.
> -N is a column number relative to selected frame."
> -  (- n
> -     (car (window-edges))
> -     (or (car (window-margins)) 0)
> -     (fringe-columns 'left)
> +START-OR-END-EVENT is the start point or end point of a mouse
> +click or mouse drag event.
> +                                                                  
> +See also: `event-start', `event-end', `posn-col-row', `posn-area'.
> +"                                                                 
> +  (- (car (posn-col-row start-or-end-event))                      
> +     (if (eq (posn-area start) 'header-line)
                           ^^^^^
I guess this should be `start-or-end-event' (otherwise the byte compiler
warns about a free variable).

> +         (+ (or (car (window-margins)) 0) (fringe-columns 'left)) 
> +       0)                                                         

Steve Berman





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-16 10:16     ` Stephen Berman
@ 2014-06-16 19:03       ` Andrea Rossetti
  0 siblings, 0 replies; 13+ messages in thread
From: Andrea Rossetti @ 2014-06-16 19:03 UTC (permalink / raw)
  To: Stephen Berman, rudalics; +Cc: 17788

Stephen Berman <stephen.berman@gmx.net> writes:
> I do indeed that the scroll bar on the left (it's also a non-toolkit
> scroll bar, FWIW).
> With your patch, I still get a jump of # when I drag the mouse pointer
> down out of the ruler, but now only by two columns to the left,
> regardless of whether I set the left margin or not.

  Hi Stephen, I confirm that left scroll bar was a relevant
difference between us: if I type "M-S-; (set-scroll-bar-mode 'left) RET"
in ruler-mode I get scroll-bar on left side and see the indicators
"hop" exactly two columns left, same as in your setup.

>> +     (if (eq (posn-area start) 'header-line)
>                            ^^^^^
> I guess this should be `start-or-end-event' (otherwise the byte compiler
> warns about a free variable).

  Ehm... my apologies for that :) I'm now going to post
another version of the patch (can you please throw away the
previous one). Kindest regards,

  Andrea





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-16  7:11     ` martin rudalics
@ 2014-06-16 20:26       ` Andrea Rossetti
  2014-06-16 21:34         ` Stephen Berman
  2014-06-17 23:50         ` Andrea Rossetti
  0 siblings, 2 replies; 13+ messages in thread
From: Andrea Rossetti @ 2014-06-16 20:26 UTC (permalink / raw)
  To: martin rudalics; +Cc: Stephen Berman, 17788

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

martin rudalics <rudalics@gmx.at> writes:

> After applying your earlier patch this won't apply any more.  Kindly
> provide a new one against the present trunk.
>

Hi! I did the following:

- cloned http://git.savannah.gnu.org/cgit/emacs.git
  at commit 19428947aaf2c68ad735a65bdc02d0523b5d15ae 
  (Mon Jun 16 12:49:09 2014 +0400)

- applied the same changes as before, additionally taking into account
  Stephen's observations about left scroll-bar and a compilation error

- checked that the modified ruler-mode.el compiles with no errors
  and no warnings
  
- rebuilt the patch with "git format-patch 19428947aaf2c68ad735a65bdc02d0523b5d15ae"

  The new tentative patch is attached here below:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-bug-17788-ruler-mode-indicators-hop-left-while-dragg.patch --]
[-- Type: text/x-patch, Size: 3206 bytes --]

From b3019446c982e3b1e7ca620f18339677131515f1 Mon Sep 17 00:00:00 2001
From: Andrea Rossetti <andrea.rossetti@gmail.com>
Date: Mon, 16 Jun 2014 22:01:26 +0200
Subject: [PATCH] bug#17788: ruler-mode indicators "hop" left while dragging

---
 lisp/ruler-mode.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 238754e..5543248 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -302,13 +302,19 @@ or remove a tab stop.  \\[ruler-mode-toggle-show-tab-stops] or
   (let ((edges (window-edges)))
     (- (nth 2 edges) (nth 0 edges))))
 
-(defsubst ruler-mode-window-col (n)
+(defsubst ruler-mode-window-col (start-or-end-event)
   "Return a column number relative to the selected window.
-N is a column number relative to selected frame."
-  (- n
-     (or (car (window-margins)) 0)
-     (fringe-columns 'left)
-     (scroll-bar-columns 'left)))
+START-OR-END-EVENT is the start point or end point of a mouse
+click or mouse drag event.
+
+See also: `event-start', `event-end', `posn-col-row', `posn-area'."
+  (- (car (posn-col-row start-or-end-event))
+     (if (eq (posn-area start-or-end-event) 'header-line)
+         (+
+          (or (car (window-margins)) 0)
+          (fringe-columns 'left)
+          (scroll-bar-columns 'left))
+       0)))
 \f
 (defun ruler-mode-mouse-set-left-margin (start-event)
   "Set left margin end to the graduation where the mouse pointer is on.
@@ -371,7 +377,7 @@ dragging.  See also the variable `ruler-mode-dragged-symbol'."
          col newc oldc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row start)))
+      (setq col  (ruler-mode-window-col start)
             newc (+ col (window-hscroll)))
       (and
        (>= col 0) (< col (window-width))
@@ -454,7 +460,7 @@ Called on each mouse motion event START-EVENT."
          col newc)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col  (ruler-mode-window-col (car (posn-col-row end)))
+      (setq col  (ruler-mode-window-col end)
             newc (+ col (window-hscroll)))
       (when (and (>= col 0) (< col (window-width)))
         (set ruler-mode-dragged-symbol newc)))))
@@ -470,7 +476,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (not (member ts tab-stop-list))
@@ -490,7 +496,7 @@ START-EVENT is the mouse click event."
       (when (eq start end) ;; mouse click
         (save-selected-window
           (select-window (posn-window start))
-          (setq col (ruler-mode-window-col (car (posn-col-row start)))
+          (setq col (ruler-mode-window-col start)
                 ts  (+ col (window-hscroll)))
           (and (>= col 0) (< col (window-width))
                (member ts tab-stop-list)
-- 
1.8.1.msysgit.1


[-- Attachment #3: Type: text/plain, Size: 93 bytes --]


  Thanks in advance to anyone patient enough to test the patch.
Kindest regards, 

  Andrea

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-16 20:26       ` Andrea Rossetti
@ 2014-06-16 21:34         ` Stephen Berman
  2014-06-17 23:50         ` Andrea Rossetti
  1 sibling, 0 replies; 13+ messages in thread
From: Stephen Berman @ 2014-06-16 21:34 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 17788

On Mon, 16 Jun 2014 22:26:40 +0200 Andrea Rossetti <andrea.rossetti@gmail.com> wrote:

> martin rudalics <rudalics@gmx.at> writes:
>
>> After applying your earlier patch this won't apply any more.  Kindly
>> provide a new one against the present trunk.
>>
>
> Hi! I did the following:
>
> - cloned http://git.savannah.gnu.org/cgit/emacs.git
>   at commit 19428947aaf2c68ad735a65bdc02d0523b5d15ae 
>   (Mon Jun 16 12:49:09 2014 +0400)
>
> - applied the same changes as before, additionally taking into account
>   Stephen's observations about left scroll-bar and a compilation error
>
> - checked that the modified ruler-mode.el compiles with no errors
>   and no warnings
>   
> - rebuilt the patch with "git format-patch 19428947aaf2c68ad735a65bdc02d0523b5d15ae"
>
>   The new tentative patch is attached here below:

I confirm that starting Emacs with -Q and this patch, # in the ruler no
longer jumps when mouse-2 is dragged straight down out of the ruler.
(For some reason, patch failed to apply the first hunk, but I applied it
by hand and rebuilt Emacs without a problem or warning.)

Steve Berman





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-16 20:26       ` Andrea Rossetti
  2014-06-16 21:34         ` Stephen Berman
@ 2014-06-17 23:50         ` Andrea Rossetti
  1 sibling, 0 replies; 13+ messages in thread
From: Andrea Rossetti @ 2014-06-17 23:50 UTC (permalink / raw)
  To: 17788

Andrea Rossetti <andrea.rossetti@gmail.com> writes:
>
>   The new tentative patch is attached here below:
> ....
> +(defsubst ruler-mode-window-col (start-or-end-event)
> ....
> +  (- (car (posn-col-row start-or-end-event))
> +     (if (eq (posn-area start-or-end-event) 'header-line)
> +         (+
> +          (or (car (window-margins)) 0)
> +          (fringe-columns 'left)
> +          (scroll-bar-columns 'left))
> +       0)))

  Some additional word of comment: 

 - I believe the implicit meaning of the above code is 
   "(car (posn-col-row ...)) is fine in text area, but needs
   to be `adjusted' when the drag is performed in header-line
   area";

- whether this adjustment should really be performed by
  posn-col-row or by ruler-mode-window-col is not very clear
  to me; I conjectured that subr.el provides somewhat
  `lower-level' service functions who probably don't want
  to know about window-margins, fringe-columns,
  scroll-bar-columns, but I might be wrong;

- be aware that dragging the column indicators does not work
  if you use non-zero zoom (C-x C-+ or C-x C--); this is an
  independent problem that the patch does not address; the
  issue would need his own bug report.

  Thanks for reading, kindest regards.

Andrea





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2014-06-15 19:17 bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally Andrea Rossetti
  2014-06-15 22:09 ` Stephen Berman
  2014-06-16  7:11 ` martin rudalics
@ 2020-09-09 11:47 ` Lars Ingebrigtsen
  2022-02-22 14:23   ` Lars Ingebrigtsen
  2 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-09 11:47 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 17788

Andrea Rossetti <andrea.rossetti@gmail.com> writes:

>  - start emacs -Q
>  - M-x ruler-mode RET
>  - click S-<mouse-1> on the column 10 of the ruler, this will set a left
>    margin
>  - you will see the ruler has two column indicators in red colour:
>    "#" for comment column, and "pilcrow" symbol for paragraph fill indicator
>  - click and hold down mouse-2 (= center mouse button) on the red "#" indicator
>  - drag the indicator horizontally; indicator will follow the mouse as expected
>  - continue dragging slightly diagonally (for example in West-South-West
>    direction); as soon as you drag the mouse out of the grey ruler area,
>    you will see that the indicator "hops" left of about 10 columns

I can confirm that this bug is still present in Emacs 28.  (Well, it
behaves slightly differently, but the "jump" is still there.)

Andrea Rossetti <andrea.rossetti@gmail.com> writes:

>   The new tentative patch is attached here below:

This unfortunately got no followup at the time, and in the years since
this, ruler-mode has changed substantially, and the patch no longer
applies.

Would it be possible for you to respin the patch, and we can actually
get it applied this time?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
  2020-09-09 11:47 ` Lars Ingebrigtsen
@ 2022-02-22 14:23   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-22 14:23 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: 17788

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Would it be possible for you to respin the patch, and we can actually
> get it applied this time?

I redid the patch for Emacs 29, and it seems to work fine, so I've
pushed it now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-02-22 14:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15 19:17 bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally Andrea Rossetti
2014-06-15 22:09 ` Stephen Berman
2014-06-15 23:06   ` Andrea Rossetti
2014-06-15 23:14     ` Andrea Rossetti
2014-06-16  7:11     ` martin rudalics
2014-06-16 20:26       ` Andrea Rossetti
2014-06-16 21:34         ` Stephen Berman
2014-06-17 23:50         ` Andrea Rossetti
2014-06-16 10:16     ` Stephen Berman
2014-06-16 19:03       ` Andrea Rossetti
2014-06-16  7:11 ` martin rudalics
2020-09-09 11:47 ` Lars Ingebrigtsen
2022-02-22 14:23   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).