[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag th
From: |
Andrea Rossetti |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) |
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:
>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)))
(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
Thanks in advance to anyone patient enough to test the patch.
Kindest regards,
Andrea
bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally, martin rudalics, 2014/06/16