From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Rossetti Newsgroups: gmane.emacs.bugs Subject: bug#17788: 24.3; ruler-mode: column indicators "hop" left if you drag them diagonally Date: Mon, 16 Jun 2014 01:06:55 +0200 Message-ID: <84zjhdixgw.fsf@gmail.com> References: <84ppiahtix.fsf@gmail.com> <87fvj5omej.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1402873711 11198 80.91.229.3 (15 Jun 2014 23:08:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Jun 2014 23:08:31 +0000 (UTC) Cc: 17788@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 16 01:08:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WwJXB-0001hz-Qs for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Jun 2014 01:08:22 +0200 Original-Received: from localhost ([::1]:40126 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwJXB-0006la-Ce for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Jun 2014 19:08:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwJX0-0006kc-Pp for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2014 19:08:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwJWt-0004Ym-4a for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2014 19:08:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwJWt-0004Yi-0T for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2014 19:08:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WwJWs-00050S-E8 for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2014 19:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Rossetti Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Jun 2014 23:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17788 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17788-submit@debbugs.gnu.org id=B17788.140287363219181 (code B ref 17788); Sun, 15 Jun 2014 23:08:02 +0000 Original-Received: (at 17788) by debbugs.gnu.org; 15 Jun 2014 23:07:12 +0000 Original-Received: from localhost ([127.0.0.1]:48556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WwJW2-0004zH-H9 for submit@debbugs.gnu.org; Sun, 15 Jun 2014 19:07:11 -0400 Original-Received: from mail-wi0-f178.google.com ([209.85.212.178]:45704) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WwJVx-0004yi-W7 for 17788@debbugs.gnu.org; Sun, 15 Jun 2014 19:07:07 -0400 Original-Received: by mail-wi0-f178.google.com with SMTP id n15so3160632wiw.11 for <17788@debbugs.gnu.org>; Sun, 15 Jun 2014 16:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=cIp/gKs0WkYxIk7cghrw51082tzRUmudT4XH3e4He1o=; b=IGrqGHOWEn+XBFPVW6eGIjp/ebqKeK1IcYoFp1is58/vXTPGVUae0rh8TGNpFbQ+A+ k3dguBEa56TAV3tG6+g+krT5CyoWfG6FXe/JCZRFUnHNQuKBxkuAmWPSZL1EcNuEeD1Y IZnLH5LOjXfQqyD9gipsCvnwKwd6nIhANkpu5wjSP0tv8JQNyNplgxnXwFEAVwkZwQdT nIESpwkPTj8xqKnNVVMuXdzXkXkIsq+M7qWMArORz4EEIQC06Dt7pla1Q1lA9/WhBnFZ qdP4ZP16zm5tZDjWqqz/0WjTiEtIYnDhI+NnkO5NxpSBiK1Ca7Mkt/y8o/ihxoFOUIeA CBNg== X-Received: by 10.194.63.46 with SMTP id d14mr23259411wjs.24.1402873620195; Sun, 15 Jun 2014 16:07:00 -0700 (PDT) Original-Received: from LAPTOP-ANDREA.laptop-andrea.trieste.it (net-93-144-96-92.cust.dsl.teletu.it. [93.144.96.92]) by mx.google.com with ESMTPSA id l45sm29743389eep.25.2014.06.15.16.06.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 15 Jun 2014 16:06:59 -0700 (PDT) In-Reply-To: <87fvj5omej.fsf@rosalinde.fritz.box> (Stephen Berman's message of "Mon, 16 Jun 2014 00:09:24 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:90412 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-bug-17788-ruler-mode-indicators-hops-left.patch >From a9e5f6508e0ef3f582b78d174ac173ac1c403585 Mon Sep 17 00:00:00 2001 From: Andrea Rossetti 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))) (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 --=-=-= Content-Type: text/plain Thanks in advance, kindest regards. Andrea --=-=-=--