unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Rossetti <andrea.rossetti@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: Stephen Berman <stephen.berman@gmx.net>, 17788@debbugs.gnu.org
Subject: bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally
Date: Mon, 16 Jun 2014 22:26:40 +0200	[thread overview]
Message-ID: <847g4gd2in.fsf@gmail.com> (raw)
In-Reply-To: <539E9891.8020507@gmx.at> (martin rudalics's message of "Mon, 16 Jun 2014 09:11:13 +0200")

[-- 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

  reply	other threads:[~2014-06-16 20:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=847g4gd2in.fsf@gmail.com \
    --to=andrea.rossetti@gmail.com \
    --cc=17788@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    --cc=stephen.berman@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).