From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#25308: Shorten long "ui-lines" in Custom buffers Date: Sun, 03 Nov 2019 14:13:05 +0100 Message-ID: <87h83ldrxa.fsf@marxist.se> References: <87eg0o2psh.fsf@bernoul.li> <83o9zsgq0n.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="89094"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Jonas Bernoulli , 25308@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 03 14:14:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iRFhs-000N1m-HJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Nov 2019 14:14:12 +0100 Original-Received: from localhost ([::1]:53752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRFhq-0004zR-NS for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Nov 2019 08:14:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59110) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iRFhj-0004z5-An for bug-gnu-emacs@gnu.org; Sun, 03 Nov 2019 08:14:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iRFhi-0002SI-1c for bug-gnu-emacs@gnu.org; Sun, 03 Nov 2019 08:14:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52877) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iRFhh-0002SA-TC for bug-gnu-emacs@gnu.org; Sun, 03 Nov 2019 08:14:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iRFhh-0002ff-MM for bug-gnu-emacs@gnu.org; Sun, 03 Nov 2019 08:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Nov 2019 13:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25308 X-GNU-PR-Package: emacs Original-Received: via spool by 25308-submit@debbugs.gnu.org id=B25308.157278679810203 (code B ref 25308); Sun, 03 Nov 2019 13:14:01 +0000 Original-Received: (at 25308) by debbugs.gnu.org; 3 Nov 2019 13:13:18 +0000 Original-Received: from localhost ([127.0.0.1]:33465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iRFh0-0002eU-D7 for submit@debbugs.gnu.org; Sun, 03 Nov 2019 08:13:18 -0500 Original-Received: from host.gofardesign.uk ([208.79.239.190]:49165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iRFgx-0002eF-Tr for 25308@debbugs.gnu.org; Sun, 03 Nov 2019 08:13:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=600ujXrgsaOEcJJ3y5Iwv9QQenB4y1lNwuSF0y8XPa0=; b=Mlck98PbR7eM7N6kjeJDnv+z0O DFVAEXFYWethpAuV6Go/diir2Xe0wbcV2x/JwKyAW/9JF7D/+8jOsFfMXc1snIipCx4SF3rUZIF4a 2VBVT1OHtEWbWWcSI9fbwGOq1cAXQGKo3EHU22Uml94U5CZvd7wx/S366t9IoNkBxXEM=; Original-Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:60172 helo=localhost) by host.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iRFgp-0000r4-73; Sun, 03 Nov 2019 07:13:07 -0600 In-Reply-To: <83o9zsgq0n.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 31 Dec 2016 15:57:28 +0200") X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: host.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: host.gofardesign.uk: stefan@marxist.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:170866 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Jonas Bernoulli >> Date: Sat, 31 Dec 2016 14:26:06 +0100 >> >> Custom buffers contain two long lines, the first separating the initial >> buttons from the options shown below, and the second is for symmetry, I >> suppose. This is implemented in `custom-group-value-create'. >> >> These lines are 999 characters long. When point ends up on the "line >> line", then it ends up at the *end* of that line, scrolling all content >> except for the line itself off-window. This happens both with C-n/C-p, >> as well as when using the mouse scroll wheel. > > The scrolling only happens for me if I set truncate-lines to a non-nil > value. Is that what you see? Or perhaps you invoke Customize in a > partial-width window, in which case truncate-partial-width-windows is > non-nil by default? > > If lines are not truncated, there's no horizontal scrolling. I see the same thing here. >> If that is considered to be too ugly, then I would suggest setting the >> `:align-to' to be just long enough to reach the edge of the window (but >> never longer) at the time `custom-group-value-create' is called, using >> something like: >> >> (list 'space :align-to >> `(+ (0 . right) >> ,(min (window-hscroll) >> (- (line-end-position) >> (line-beginning-position))))) > > Does this really work when a window has its lines truncated? Yes, it works on both text based and graphical displays. Please see the attached patch. Lars suggested to remove the lines entirely, but I think I prefer to not change that for now. Perhaps it would make more sense as part of a bigger overhaul of the look and feel of customize. Any comments? Best regards, Stefan Kangas --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Handle-truncate-lines-in-customize-group.patch >From 432de377610215219ad9c61ad63950fd914eb883 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Nov 2019 14:07:37 +0100 Subject: [PATCH] Handle truncate-lines in customize-group * lisp/cus-edit.el (custom-group--draw-horizontal-line): New function to draw horizontal lines which handles a non-nil value of 'truncate-lines'. (Bug#25308) (custom-group-value-create): Use it. Co-authored-by: Jonas Bernoulli --- lisp/cus-edit.el | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index b9fd3e0a2d..081d4c9213 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4062,6 +4062,22 @@ custom-group-members (push entry members))) (nreverse members)))) +(defun custom-group--draw-horizontal-line () + "Draw a horizontal line at point. +This works for both graphical and text displays." + (let ((p (point))) + (insert "\n") + (put-text-property p (1+ p) 'face '(:underline t)) + (overlay-put (make-overlay p (1+ p)) + 'before-string + (propertize "\n" 'face '(:underline t) + 'display + (list 'space :align-to + `(+ (0 . right) + ,(min (window-hscroll) + (- (line-end-position) + (line-beginning-position))))))))) + (defun custom-group-value-create (widget) "Insert a customize group for WIDGET in the current buffer." (unless (eq (widget-get widget :custom-state) 'hidden) @@ -4188,15 +4204,7 @@ custom-group-value-create ;; Nested style. (t ;Visible. - ;; Draw a horizontal line (this works for both graphical - ;; and text displays): - (let ((p (point))) - (insert "\n") - (put-text-property p (1+ p) 'face '(:underline t)) - (overlay-put (make-overlay p (1+ p)) - 'before-string - (propertize "\n" 'face '(:underline t) - 'display '(space :align-to 999)))) + (custom-group--draw-horizontal-line) ;; Add parent groups references above the group. (when (eq level 1) @@ -4287,13 +4295,7 @@ custom-group-value-create (widget-put widget :children children) (custom-group-state-update widget)) ;; End line - (let ((p (1+ (point)))) - (insert "\n\n") - (put-text-property p (1+ p) 'face '(:underline t)) - (overlay-put (make-overlay p (1+ p)) - 'before-string - (propertize "\n" 'face '(:underline t) - 'display '(space :align-to 999)))))))) + (custom-group--draw-horizontal-line))))) (defvar custom-group-menu `(("Set for Current Session" custom-group-set -- 2.20.1 --=-=-=--