[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when trun
From: |
Juri Linkov |
Subject: |
bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect |
Date: |
Tue, 23 Aug 2022 19:49:40 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>> >> (or truncate-lines (truncated-partial-width-window-p))
>> >
>> > Fine by me.
>>
>> Then I'll push a better patch:
>
> Btw, I didn't use window-total-width instead of window-width. What I
> did mimics what the display engine does when it determines whether to
> truncate lines in a window. So I think
> truncated-partial-width-window-p should be fixed to use
> window-total-width instead.
Now this patch fixes truncated-partial-width-window-p to use
window-total-width. Also it fixes the recent code for
long_line_optimizations_p in scan_for_column to better mimic
what the display engine does:
diff --git a/lisp/simple.el b/lisp/simple.el
index 460aff8bd8..6e8cd798e0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7700,13 +7700,7 @@ line-move
;; 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)))
@@ -7716,14 +7710,7 @@ line-move
;; Display-based column are incompatible with goal-column.
(not goal-column)
;; Lines aren't truncated.
- (not
- (or truncate-lines
- (and (integerp truncate-partial-width-windows)
- (< (window-width)
- truncate-partial-width-windows))
- (and truncate-partial-width-windows
- (not (integerp truncate-partial-width-windows))
- (not (window-full-width-p)))))
+ (not (or truncate-lines (truncated-partial-width-window-p)))
;; When the text in the window is scrolled to the left,
;; display-based motion doesn't make sense (because each
;; logical line occupies exactly one screen line).
@@ -7983,7 +7970,7 @@ line-move-finish
;; 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..a2559a2591 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9044,10 +9055,7 @@ count-screen-lines
;; 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 +10148,7 @@ scroll-command--goto-goal-column
(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 +10457,7 @@ truncated-partial-width-window-p
(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)
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, (continued)
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Eli Zaretskii, 2022/08/14
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Juri Linkov, 2022/08/21
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Eli Zaretskii, 2022/08/21
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Juri Linkov, 2022/08/21
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Eli Zaretskii, 2022/08/21
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Juri Linkov, 2022/08/22
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Eli Zaretskii, 2022/08/22
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Juri Linkov, 2022/08/23
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Eli Zaretskii, 2022/08/23
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect,
Juri Linkov <=
- bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Juri Linkov, 2022/08/27
bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect, Juri Linkov, 2022/08/08