From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <86bksaoqfv.fsf@mail.linkov.net> References: <83mtct87ti.fsf@gnu.org> <86mtcrpyzs.fsf@mail.linkov.net> <83bkt77nf9.fsf@gnu.org> <83a68r7m2d.fsf@gnu.org> <837d3v7kr9.fsf@gnu.org> <86fsih5bch.fsf@mail.linkov.net> <83wnbs2nc3.fsf@gnu.org> <86y1w7bzum.fsf@mail.linkov.net> <83r11jj5ht.fsf@gnu.org> <86v8qlljwp.fsf@mail.linkov.net> <83k071bk6z.fsf@gnu.org> <86edx9fmgb.fsf@mail.linkov.net> <83fshpbdab.fsf@gnu.org> <86sfloixio.fsf@mail.linkov.net> <838rngbjke.fsf@gnu.org> <86zgfvie26.fsf@mail.linkov.net> <83o7wb88ht.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9153"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 56815@debbugs.gnu.org, gregory@heytings.org, larsi@gnus.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 23 18:51:13 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQX7R-0002Bt-13 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Aug 2022 18:51:13 +0200 Original-Received: from localhost ([::1]:59004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQX7P-0002I5-Tm for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Aug 2022 12:51:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQX7G-0002Gk-Op for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 12:51:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQX7G-00062Y-GS for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 12:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQX7G-00007x-62 for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 12:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Aug 2022 16:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56815 X-GNU-PR-Package: emacs Original-Received: via spool by 56815-submit@debbugs.gnu.org id=B56815.1661273448468 (code B ref 56815); Tue, 23 Aug 2022 16:51:02 +0000 Original-Received: (at 56815) by debbugs.gnu.org; 23 Aug 2022 16:50:48 +0000 Original-Received: from localhost ([127.0.0.1]:44918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQX71-00007U-Jb for submit@debbugs.gnu.org; Tue, 23 Aug 2022 12:50:47 -0400 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:37889) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQX6z-00007H-Ph for 56815@debbugs.gnu.org; Tue, 23 Aug 2022 12:50:46 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 08E7B240002; Tue, 23 Aug 2022 16:50:37 +0000 (UTC) In-Reply-To: <83o7wb88ht.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 23 Aug 2022 15:11:42 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:240560 Archived-At: --=-=-= Content-Type: text/plain >> >> (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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=truncated-partial-width-window-p.patch 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) --=-=-=--