emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3f076a8e44: Use truncated-partial-width-window-p in more places (


From: Juri Linkov
Subject: master 3f076a8e44: Use truncated-partial-width-window-p in more places (bug#56815)
Date: Sat, 27 Aug 2022 15:52:25 -0400 (EDT)

branch: master
commit 3f076a8e44b652691ffd4a2a07b04ab956ed4668
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Use truncated-partial-width-window-p in more places (bug#56815)
    
    * lisp/simple.el (line-move, line-move-finish):
    Use truncated-partial-width-window-p.
    
    * lisp/window.el (count-screen-lines, scroll-command--goto-goal-column):
    Use truncated-partial-width-window-p.
    (truncated-partial-width-window-p): Replace window-width with
    window-total-width.
    
    * src/indent.c (scan_for_column): Bring the logic of using
    truncated-partial-width-window-p closer to what the display engine does.
---
 lisp/simple.el | 18 +++---------------
 lisp/window.el |  9 +++------
 src/indent.c   | 15 +++++++++------
 3 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index d18d54ce16..ceb29b1e30 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7700,13 +7700,7 @@ not vscroll."
                  ;; Lines are not truncated...
                  (not
                   (and
-                   (or truncate-lines
-                       (and (integerp truncate-partial-width-windows)
-                            (< (window-total-width)
-                               truncate-partial-width-windows))
-                       (and truncate-partial-width-windows
-                            (not (integerp truncate-partial-width-windows))
-                            (not (window-full-width-p))))
+                   (or truncate-lines (truncated-partial-width-window-p))
                    ;; ...or if lines are truncated, this buffer
                    ;; doesn't have very long lines.
                    (long-line-optimizations-p)))
@@ -7718,13 +7712,7 @@ not vscroll."
                ;; Lines aren't truncated.
                (not
                 (and
-                 (or truncate-lines
-                     (and (integerp truncate-partial-width-windows)
-                          (< (window-total-width)
-                             truncate-partial-width-windows))
-                     (and truncate-partial-width-windows
-                          (not (integerp truncate-partial-width-windows))
-                          (not (window-full-width-p))))
+                 (or truncate-lines (truncated-partial-width-window-p))
                  (long-line-optimizations-p)))
               ;; When the text in the window is scrolled to the left,
               ;; display-based motion doesn't make sense (because each
@@ -7985,7 +7973,7 @@ If NOERROR, don't signal an error if we can't move that 
many lines."
 
        ;; Move to the desired column.
         (if (and line-move-visual
-                 (not (or truncate-lines truncate-partial-width-windows)))
+                 (not (or truncate-lines (truncated-partial-width-window-p))))
             ;; Under line-move-visual, goal-column should be
             ;; interpreted in units of the frame's canonical character
             ;; width, which is exactly what vertical-motion does.
diff --git a/lisp/window.el b/lisp/window.el
index 4d88ffa903..db69379e69 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9044,10 +9044,7 @@ in some window."
       ;; vertical-motion returns a number that is 1 larger than it
       ;; should.  We need to fix that.
       (setq end-invisible-p
-            (and (or truncate-lines
-                     (and (natnump truncate-partial-width-windows)
-                          (< (window-total-width window)
-                             truncate-partial-width-windows)))
+            (and (or truncate-lines (truncated-partial-width-window-p window))
                  (save-excursion
                    (goto-char finish)
                    (> (- (current-column) (window-hscroll window))
@@ -10140,7 +10137,7 @@ semipermanent goal column for this command."
   (when goal-column
     ;; Move to the desired column.
     (if (and line-move-visual
-             (not (or truncate-lines truncate-partial-width-windows)))
+             (not (or truncate-lines (truncated-partial-width-window-p))))
         ;; Under line-move-visual, goal-column should be
         ;; interpreted in units of the frame's canonical character
         ;; width, which is exactly what vertical-motion does.
@@ -10449,7 +10446,7 @@ Otherwise, consult the value of 
`truncate-partial-width-windows'
     (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows
                                       (window-buffer window))))
       (if (integerp t-p-w-w)
-         (< (window-width window) t-p-w-w)
+         (< (window-total-width window) t-p-w-w)
         t-p-w-w))))
 
 
diff --git a/src/indent.c b/src/indent.c
index cb368024d9..aa905f387b 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -577,12 +577,15 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol,
 
       if (!NILP (BVAR (current_buffer, truncate_lines)))
        lines_truncated = true;
-      else if (w && FIXNUMP (Vtruncate_partial_width_windows))
-       lines_truncated =
-         w->total_cols < XFIXNAT (Vtruncate_partial_width_windows);
-      else if (w && !NILP (Vtruncate_partial_width_windows))
-       lines_truncated =
-         w->total_cols < FRAME_COLS (XFRAME (WINDOW_FRAME (w)));
+      else if (!NILP (Vtruncate_partial_width_windows) && w
+              && w->total_cols < FRAME_COLS (XFRAME (WINDOW_FRAME (w))))
+       {
+         if (FIXNUMP (Vtruncate_partial_width_windows))
+           lines_truncated =
+             w->total_cols < XFIXNAT (Vtruncate_partial_width_windows);
+         else
+           lines_truncated = true;
+       }
       /* Special optimization for buffers with long and truncated
         lines: assumes that each character is a single column.  */
       if (lines_truncated)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]