emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix window width when line numbers present
@ 2021-11-21 18:41 Matt Huszagh
  2021-11-21 19:14 ` Timothy
  2021-11-21 19:19 ` Timothy
  0 siblings, 2 replies; 21+ messages in thread
From: Matt Huszagh @ 2021-11-21 18:41 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-11-23  7:15 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21 18:41 [PATCH] Fix window width when line numbers present Matt Huszagh
2021-11-21 19:14 ` 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

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).