unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: 75020@debbugs.gnu.org
Subject: bug#75020: [PATCH] Fix make-separator-line for ttys not supporting underline
Date: Sun, 22 Dec 2024 08:43:14 +0100	[thread overview]
Message-ID: <m2wmfsi2nh.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

Tags: patch

To reproduce, emacs -nw -Q on a terminal not supporting underlining (in
my case Terminal.app on macOS).

- M-x display-line-number-mode RET
- Eval (insert (amke-separator-line))

=> the separator line is too long

Attached patch fixes that.



In GNU Emacs 31.0.50 (build 4, aarch64-apple-darwin24.2.0) of 2024-12-21
 built on pro2
Repository revision: cbafbb2dd57993397c0d624461e3611831414e91
Repository branch: cl-packages
System Description:  macOS 15.2

Configured using:
 'configure --without-ns --cache-file
 /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//config.cache.cl-packages
 --with-native-compilation --with-mps=yes CC=clang
 'CFLAGS=-Wgnu-imaginary-constant -Wunused-result -g
 -fno-omit-frame-pointer -F
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
 -Wno-ignored-attributes -Wno-flag-enum -Wno-missing-method-return-type
 -Wno-variadic-macros -Wno-strict-prototypes -Wno-availability
 -Wno-nullability-completeness' --prefix=/Users/gerd/.local'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-make-separator-line-for-ttys-not-supporting-unde.patch --]
[-- Type: text/patch, Size: 1188 bytes --]

From d481da70010eab163d12f770ed11f8fef171406a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <gerd@gnu.org>
Date: Sun, 22 Dec 2024 08:35:40 +0100
Subject: [PATCH] Fix make-separator-line for ttys not supporting underline

* lisp/simple.el (make-separator-line): Use window-max-chars-per-line
instead of window-width.
---
 lisp/simple.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index cb3b12d4402..bd8466a5b1a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -745,8 +745,9 @@ make-separator-line
           (concat (propertize (make-string length ?\s) 'face 'separator-line)
                   "\n")
         (propertize "\n" 'face '(:inherit separator-line :extend t)))
-    ;; In terminals (that don't support underline), use a line of dashes.
-    (concat (propertize (make-string (or length (1- (window-width))) ?-)
+    ;; In terminals that don't support underline, use a line of dashes.
+    (concat (propertize (make-string (or length
+                                         (1- (window-max-chars-per-line))) ?-)
                         'face 'separator-line)
             "\n")))
 
-- 
2.47.1


             reply	other threads:[~2024-12-22  7:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22  7:43 Gerd Möllmann [this message]
2024-12-22  8:22 ` bug#75020: [PATCH] Fix make-separator-line for ttys not supporting underline Eli Zaretskii
2024-12-22  8:49   ` Gerd Möllmann
2024-12-22 12:20     ` Eli Zaretskii
2024-12-22 13:19       ` Gerd Möllmann

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=m2wmfsi2nh.fsf@gmail.com \
    --to=gerd.moellmann@gmail.com \
    --cc=75020@debbugs.gnu.org \
    /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).