GNU bug report logs - #59527
29.0.50; Face issues in show-paren context overlay

Previous Next

Package: emacs;

Reported by: Gabriel <gabriel376 <at> hotmail.com>

Date: Thu, 24 Nov 2022 00:28:02 UTC

Severity: normal

Found in version 29.0.50

To reply to this bug, email your comments to 59527 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59527; Package emacs. (Thu, 24 Nov 2022 00:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gabriel <gabriel376 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Nov 2022 00:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Face issues in show-paren context overlay
Date: Wed, 23 Nov 2022 21:22:02 -0300
[Message part 1 (text/plain, inline)]
Description:

The context overlay (from show-paren) has some face issues.  First, in
case font-lock was not applied to a previous region of the buffer, the
overlay will not display the context with font-lock.  Second, the
overlay will be displayed with the same background as the top-left line
of the window instead of the original context background.

Steps:

1) emacs -Q (master "b42cd524b46a4f29ef13e9d03be9d3df917f9aa3")

2) eval:

(progn
    ;; enable overlay context in show-paren
    (setopt show-paren-context-when-offscreen 'overlay)

    ;; just to have a different background to reproduce issue #2
    (add-hook 'c-mode-hook #'whitespace-mode))

3) Open file src/xdisp.c from emacs source tree: C-x C-f emacs/src/xdisp.c

4) Go to line 13418: M-g M-g 13418

5) Go to next char (the context overlay will be displayed): C-f

Problem 1: the overlay context does not have font-lock, since font-lock
was not applied to the previous area that contains the context.  As a
workaround, execute C-M b (to navigate to context and force font-lock
update) and then C-M-f to navigate back and display again the overlay
context (with correct font-lock, this time).  I expect the context
overlay to always be displayed with an updated font-lock.

Problem 2: the overlay context will be displayed with the same
background color as the top-left line of the window (yellow, in this
case, because of whitespace-mode).  I expect the context overlay to
always show the correct background, regardless of the face in the
top-left line.

See attached images for more information.

[wrong font-lock.png (image/png, attachment)]
[correct font-lock.png (image/png, attachment)]
[whitespace-mode + wrong font-lock.png (image/png, attachment)]
[whitespace-mode + correct font-lock.png (image/png, attachment)]
[Message part 6 (text/plain, inline)]
---
Gabriel

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59527; Package emacs. (Thu, 24 Nov 2022 07:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 59527 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriel <gabriel376 <at> hotmail.com>, Tassilo Horn <tsdh <at> gnu.org>
Cc: 59527 <at> debbugs.gnu.org
Subject: Re: bug#59527: 29.0.50; Face issues in show-paren context overlay
Date: Thu, 24 Nov 2022 09:10:54 +0200
> From: Gabriel <gabriel376 <at> hotmail.com>
> Date: Wed, 23 Nov 2022 21:22:02 -0300
> 
> The context overlay (from show-paren) has some face issues.  First, in
> case font-lock was not applied to a previous region of the buffer, the
> overlay will not display the context with font-lock.  Second, the
> overlay will be displayed with the same background as the top-left line
> of the window instead of the original context background.
> 
> Steps:
> 
> 1) emacs -Q (master "b42cd524b46a4f29ef13e9d03be9d3df917f9aa3")
> 
> 2) eval:
> 
> (progn
>     ;; enable overlay context in show-paren
>     (setopt show-paren-context-when-offscreen 'overlay)
> 
>     ;; just to have a different background to reproduce issue #2
>     (add-hook 'c-mode-hook #'whitespace-mode))
> 
> 3) Open file src/xdisp.c from emacs source tree: C-x C-f emacs/src/xdisp.c
> 
> 4) Go to line 13418: M-g M-g 13418
> 
> 5) Go to next char (the context overlay will be displayed): C-f
> 
> Problem 1: the overlay context does not have font-lock, since font-lock
> was not applied to the previous area that contains the context.  As a
> workaround, execute C-M b (to navigate to context and force font-lock
> update) and then C-M-f to navigate back and display again the overlay
> context (with correct font-lock, this time).  I expect the context
> overlay to always be displayed with an updated font-lock.
> 
> Problem 2: the overlay context will be displayed with the same
> background color as the top-left line of the window (yellow, in this
> case, because of whitespace-mode).  I expect the context overlay to
> always show the correct background, regardless of the face in the
> top-left line.

CC'ing Tassilo, who implemented this feature.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59527; Package emacs. (Thu, 24 Nov 2022 07:21:01 GMT) Full text and rfc822 format available.

Message #11 received at 59527 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Gabriel <gabriel376 <at> hotmail.com>, 59527 <at> debbugs.gnu.org
Subject: Re: bug#59527: 29.0.50; Face issues in show-paren context overlay
Date: Thu, 24 Nov 2022 08:18:27 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Gabriel & Eli,

>> Problem 1: the overlay context does not have font-lock, since
>> font-lock was not applied to the previous area that contains the
>> context.  As a workaround, execute C-M b (to navigate to context and
>> force font-lock update) and then C-M-f to navigate back and display
>> again the overlay context (with correct font-lock, this time).  I
>> expect the context overlay to always be displayed with an updated
>> font-lock.
>> 
>> Problem 2: the overlay context will be displayed with the same
>> background color as the top-left line of the window (yellow, in this
>> case, because of whitespace-mode).  I expect the context overlay to
>> always show the correct background, regardless of the face in the
>> top-left line.
>
> CC'ing Tassilo, who implemented this feature.

Thanks for the very detailed bug report.  That's very appreciated.  I
will have a look ASAP.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59527; Package emacs. (Thu, 24 Nov 2022 10:00:02 GMT) Full text and rfc822 format available.

Message #14 received at 59527 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Gabriel <gabriel376 <at> hotmail.com>, 59527 <at> debbugs.gnu.org
Subject: Re: bug#59527: 29.0.50; Face issues in show-paren context overlay
Date: Thu, 24 Nov 2022 10:55:15 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi Gabriel & Eli,

>> (progn
>>     ;; enable overlay context in show-paren
>>     (setopt show-paren-context-when-offscreen 'overlay)

Note that the issue was also present with t (minibuffer message) or the
child-frame version.

The issue is hopefully fixed with 005efce764.  Please report back.

>> Problem 1: the overlay context does not have font-lock, since
>> font-lock was not applied to the previous area that contains the
>> context.

I now ensure the region is font-locked before taking the
buffer-substring(s).

>> Problem 2: the overlay context will be displayed with the same
>> background color as the top-left line of the window (yellow, in this
>> case, because of whitespace-mode).

I now set the overlay priority to (the very high) show-paren-priority
which seems to do the trick.

Bye,
Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59527; Package emacs. (Thu, 24 Nov 2022 11:23:01 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#59527: 29.0.50; Face issues in show-paren context overlay
Date: Thu, 24 Nov 2022 08:21:59 -0300
[Message part 1 (text/plain, inline)]
Hi Tassilo,

Thank you for the quick fix.

>>> Problem 1: the overlay context does not have font-lock, since
>>> font-lock was not applied to the previous area that contains the
>>> context.
>
> I now ensure the region is font-locked before taking the
> buffer-substring(s).
>

I confirm that problem #1 is fixed.

>>> Problem 2: the overlay context will be displayed with the same
>>> background color as the top-left line of the window (yellow, in this
>>> case, because of whitespace-mode).
>
> I now set the overlay priority to (the very high) show-paren-priority
> which seems to do the trick.

I can still reproduce the problem #2, where the overlay context use the
same face of the top-left line.  I suspect the issue is related to the
overlay face, not with overlay priority (but we can keep your fix that
set the overlay priority).

A simpler recipe to reproduce the issue is to make sure the first
character of the top-left line is a comment, so the overlay context will
be displayed in that face (font-lock-comment-face).  See the attached
images, where I put a comment ("/* EXAMPLE COMMENT */") in the top-left
line and the context overlay was displayed in that face.

[comment.png (image/png, attachment)]
[wrong face.png (image/png, attachment)]
[Message part 4 (text/plain, inline)]
---
Gabriel

This bug report was last modified 1 year and 147 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.