From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 56815@debbugs.gnu.org, gregory@heytings.org, larsi@gnus.org
Subject: bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect
Date: Mon, 22 Aug 2022 09:48:47 +0300 [thread overview]
Message-ID: <86sfloixio.fsf@mail.linkov.net> (raw)
In-Reply-To: <83fshpbdab.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 21 Aug 2022 22:35:24 +0300")
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
>> I guess it could be in simple.el. But what would be a good name?
>> Maybe 'truncate-lines-p'?
>
> lines-truncated-p, I guess. Or window-lines-truncated-p. And I think
> it should be in window.el.
To keep the prefix like in all truncate-related names,
truncated-partial-width-window-p could serve as an example:
(truncated-partial-width-window-p &optional WINDOW)
(truncated-lines-p &optional window)
Or can truncated-partial-width-window-p be called directly? By just
(or truncate-lines (truncated-partial-width-window-p))
Anyway, here is the patch that probably not needed
when truncated-partial-width-window-p can be used instead:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: truncated-lines-p.patch --]
[-- Type: text/x-diff, Size: 3227 bytes --]
diff --git a/lisp/simple.el b/lisp/simple.el
index d862c0e9a8..8f7440a3bb 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))))
+ (truncated-lines-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 (truncated-lines-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).
diff --git a/lisp/window.el b/lisp/window.el
index 4d88ffa903..aecac8c8d0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9012,6 +9023,18 @@ shrink-window-horizontally
(interactive "p")
(shrink-window delta t))
+(defun truncated-lines-p (&optional window)
+ "Return non-nil when lines are truncated.
+This depends on the values of `truncate-lines' and
+`truncate-partial-width-windows'."
+ (or truncate-lines
+ (and (integerp truncate-partial-width-windows)
+ (< (window-total-width window)
+ truncate-partial-width-windows))
+ (and truncate-partial-width-windows
+ (not (integerp truncate-partial-width-windows))
+ (not (window-full-width-p window)))))
+
(defun count-screen-lines (&optional beg end count-final-newline window)
"Return the number of screen lines in the region.
The number of screen lines may be different from the number of actual lines,
@@ -9044,10 +9067,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 (truncated-lines-p window)
(save-excursion
(goto-char finish)
(> (- (current-column) (window-hscroll window))
next prev parent reply other threads:[~2022-08-22 6:48 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 17:29 bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect Eli Zaretskii
2022-07-28 20:08 ` Juri Linkov
2022-07-29 5:50 ` Eli Zaretskii
2022-07-29 11:48 ` Lars Ingebrigtsen
2022-07-29 18:14 ` Juri Linkov
2022-07-29 18:37 ` Gregory Heytings
2022-07-29 19:02 ` Eli Zaretskii
2022-07-29 19:11 ` Gregory Heytings
2022-07-29 19:31 ` Eli Zaretskii
2022-07-29 19:36 ` Eli Zaretskii
2022-07-29 19:52 ` Gregory Heytings
2022-07-29 19:59 ` Eli Zaretskii
2022-07-29 20:26 ` Gregory Heytings
2022-07-30 5:35 ` Eli Zaretskii
2022-07-31 19:40 ` Juri Linkov
2022-07-31 21:21 ` Gregory Heytings
2022-08-01 11:51 ` Eli Zaretskii
2022-08-01 18:09 ` Juri Linkov
2022-08-02 7:31 ` Gregory Heytings
2022-08-02 11:10 ` Eli Zaretskii
2022-08-14 13:53 ` Eli Zaretskii
2022-08-21 16:32 ` Juri Linkov
2022-08-21 17:06 ` Eli Zaretskii
2022-08-21 19:03 ` Juri Linkov
2022-08-21 19:35 ` Eli Zaretskii
2022-08-22 6:48 ` Juri Linkov [this message]
2022-08-22 11:32 ` Eli Zaretskii
2022-08-23 7:41 ` Juri Linkov
2022-08-23 12:11 ` Eli Zaretskii
2022-08-23 16:49 ` Juri Linkov
2022-08-27 19:52 ` Juri Linkov
2022-08-08 17:20 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86sfloixio.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=56815@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=gregory@heytings.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.