From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Jonas Bernoulli <jonas@bernoul.li>, 25308@debbugs.gnu.org
Subject: bug#25308: Shorten long "ui-lines" in Custom buffers
Date: Sun, 03 Nov 2019 14:13:05 +0100 [thread overview]
Message-ID: <87h83ldrxa.fsf@marxist.se> (raw)
In-Reply-To: <83o9zsgq0n.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 31 Dec 2016 15:57:28 +0200")
[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Jonas Bernoulli <jonas@bernoul.li>
>> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Handle-truncate-lines-in-customize-group.patch --]
[-- Type: text/x-diff, Size: 2792 bytes --]
From 432de377610215219ad9c61ad63950fd914eb883 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
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 <jonas@bernoul.li>
---
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
next prev parent reply other threads:[~2019-11-03 13:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-31 13:26 bug#25308: Shorten long "ui-lines" in Custom buffers Jonas Bernoulli
2016-12-31 13:57 ` Eli Zaretskii
2019-09-29 17:55 ` Lars Ingebrigtsen
2019-11-03 13:13 ` Stefan Kangas [this message]
2019-11-03 14:34 ` Lars Ingebrigtsen
2019-11-03 15:48 ` Eli Zaretskii
2019-11-03 16:48 ` Stefan Kangas
[not found] ` <handler.25308.C.15727997177484.notifdonectrl.0@debbugs.gnu.org>
2019-11-04 13:21 ` bug#25308: acknowledged by developer (Re: bug#25308: Shorten long "ui-lines" in Custom buffers) Jonas Bernoulli
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=87h83ldrxa.fsf@marxist.se \
--to=stefan@marxist.se \
--cc=25308@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=jonas@bernoul.li \
/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).