GNU bug report logs -
#34513
display-line-numbers in term mode
Previous Next
Reported by: Ergus <spacibba <at> aol.com>
Date: Sun, 17 Feb 2019 14:21:02 UTC
Severity: normal
Tags: fixed
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 34513 <at> debbugs.gnu.org (full text, mbox):
> display-line-number-mode produces bad term buffers with extra breaks.
> When using global-display-line-numbers there are some issues in term
> mode because of the extra columns needed by the numbers.
>
> The lines are broken because "tput cols" and $COLUMNS report the total
> width of the window, but it does not take into account the 3/4 (or more)
> chars taken by the line number. So longer lines need to be broken to fit.
So it seems that some of the problems are due to the process not being
told the size of the really usable text area. This is done normally via
window-adjust-process-window-size-function which in turns calls
window-adjust-process-window-size which then calls
window-max-chars-per-line but that function does not take
display-line-numbers-width into account.
So maybe a simple fix is the patch below, but I'm not sure it's always
the right thing to do (and the width won't be automatically updated when
the (line-number-display-width) changes).
Stefan
PS: Why is the function called `line-number-display-width` when
everything else seems to use the `display-line-number` prefix?
It makes it more difficult to find.
diff --git a/lisp/window.el b/lisp/window.el
index 07a0f713c4..906e9012fe 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2132,7 +2132,7 @@ window-max-chars-per-line
(with-selected-window (window-normalize-window window t)
(let* ((window-width (window-body-width window t))
(font-width (window-font-width window face))
- (ncols (/ window-width font-width)))
+ (ncols (- (/ window-width font-width) (line-number-display-width))))
(if (and (display-graphic-p)
overflow-newline-into-fringe
(not
This bug report was last modified 4 years and 244 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.