emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Huszagh <huszaghmatt@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Fix window width when line numbers present
Date: Sun, 21 Nov 2021 10:41:22 -0800	[thread overview]
Message-ID: <87fsrpuzal.fsf@gmail.com> (raw)

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

Hello,

This is a very small patch that I believe fixes a previous, incorrect
fix for computing the window text area when line numbers are
present. The previous fix seemed to assume that
display-line-numbers-width being nil meant that this means line numbers
are not present. However, it can also mean (as described in the
variable documentation) that the line number width is computed
dynamically.

Thanks
Matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Fix-inline-image-width-calculation-when-line-.patch --]
[-- Type: text/x-patch, Size: 1194 bytes --]

From 5faaf45bf54c0cd3135b9c5a747c22797fe1d290 Mon Sep 17 00:00:00 2001
From: Matt Huszagh <huszaghmatt@gmail.com>
Date: Sun, 21 Nov 2021 10:30:30 -0800
Subject: [PATCH] org.el: Fix inline image width calculation when line numbers
 present

* lisp/org.el (org-display-inline-image--width): When
display-line-numbers-width is nil, the width is computed dynamically.
This does not mean that the line number width is necessarily 0.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index eeefb4af3..331bd9f65 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16880,7 +16880,7 @@ buffer boundaries with possible narrowing."
                     (/ (or (and (bound-and-true-p visual-fill-column-mode)
                                 (or visual-fill-column-width auto-fill-function))
                            (when auto-fill-function fill-column)
-                           (- (window-text-width) (or display-line-numbers-width 0)))
+                           (- (window-text-width) (line-number-display-width)))
                        (float (window-total-width)))))
         width)))
    ((numberp org-image-actual-width)
-- 
2.31.1


             reply	other threads:[~2021-11-21 18:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21 18:41 Matt Huszagh [this message]
2021-11-21 19:14 ` [PATCH] Fix window width when line numbers present Timothy
2021-11-21 21:08   ` Nicolas Goaziou
2021-11-21 21:14     ` Matt Huszagh
2021-11-21 21:16       ` Bastien
2021-11-21 21:22         ` Matt Huszagh
2021-11-22  5:14           ` Bastien
2021-11-22  5:31             ` Timothy
2021-11-22  5:44               ` Bastien
2021-11-22  5:51                 ` Supported Emacs version (was: [PATCH] Fix window width when line numbers present) Timothy
2021-11-22  6:05                   ` Supported Emacs version Bastien
2021-11-22  6:12                     ` Timothy
2021-11-22  6:39                       ` Bastien
2021-11-22  8:04                         ` Timothy
2021-11-22 10:26                           ` Bastien
2021-11-22 11:55                 ` [PATCH] Fix window width when line numbers present Ihor Radchenko
2021-11-22 12:40                   ` Tim Cross
2021-11-23  5:59                   ` Bastien
2021-11-23  7:05                     ` Tim Cross
2021-11-22  3:16     ` Timothy
2021-11-21 19:19 ` Timothy

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsrpuzal.fsf@gmail.com \
    --to=huszaghmatt@gmail.com \
    --cc=emacs-orgmode@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/org-mode.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).