unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Po Lu <luangruo@yahoo.com>, 63187@debbugs.gnu.org, aaronjensen@gmail.com
Subject: bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS
Date: Mon, 1 May 2023 18:26:20 +0100	[thread overview]
Message-ID: <ZE/2PF7chXbWWZEG@idiocy.org> (raw)
In-Reply-To: <83pm7knpzi.fsf@gnu.org>

On Mon, May 01, 2023 at 04:25:05PM +0300, Eli Zaretskii wrote:
> > From: Po Lu <luangruo@yahoo.com>
> > Cc: aaronjensen@gmail.com,  63187@debbugs.gnu.org
> > Date: Mon, 01 May 2023 21:18:31 +0800
> > 
> > Eli Zaretskii <eliz@gnu.org> writes:
> > 
> > >> Cc: 63187@debbugs.gnu.org
> > >> Date: Mon, 01 May 2023 07:58:26 +0800
> > >> From:  Po Lu via "Bug reports for GNU Emacs,
> > >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> > >> 
> > >> Aaron Jensen <aaronjensen@gmail.com> writes:
> > >> 
> > >> > Is there anything specific to macOS that is involved in scrolling optimization?
> > >> 
> > >> Yes, Apple deleted the API used to perform bit blits, so Emacs uses a
> > >> workaround that I don't really understand, and seems unreliable.
> > >
> > > You mean, ns_scroll_run in nsterm.m?  Which parts of it do you not
> > > understand?
> > 
> > No, I meant the implementation of [EmacsView copyRect:] enabled under
> > Mac OS; see line 8655 of nsterm.m.  I don't understand how the system
> > synchronizes its access to the window's backing store with Emacs's.
> 
> Alan, can you help?
> 
> If this is unworkable on macOS, we could simply disable this
> optimization there.  But note that scroll_run_hook is also called from
> xdisp.c, in several places, so we may need to disable it there as
> well.

This is one of the many reasons I walked away from the NS port. ;)

I'm 99% certain that [EmacsView copyRect:] is correct. I went over it
numerous times. It's just doing a simple copy of one rectangle of a
graphics buffer to another, identically sized, rectangle. It handles
overlapping rectangles and there's really not very much logic in it to
go wrong.

Po Lu asks about how it synchronises with the system, and it doesn't
really have to. The system draws into the same buffer that copyRect
accesses. It does make me wonder if there's a rare occasion when
copyRect is called and the system hasn't flushed all it's drawing
instructions to the buffer yet. It's probably possible to force it to
flush by doing something like:

    [[NSGraphicsContext currentContext] flushGraphics];

at the top of copyRect. Preferably only on macOS 10.14 and above, but
it probably makes no difference on other platforms since scrollRect
should force a flush anyway.

My memory of Aaron's previous bug report about this was that it looked
like, in some cases at least, the rectangle being copied was too wide
and copyRect, not being very smart, was just wrapping off the edge of
the buffer onto the next row of pixels, but I couldn't find any reason
for that to happen since afaik all the callers check the Emacs window
size so should never ask to copy a too-wide rectangle.

-- 
Alan Third





  parent reply	other threads:[~2023-05-01 17:26 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2fs8histt.fsf@gmail.com>
2023-04-30 10:33 ` bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS Eli Zaretskii
2023-04-30 10:46   ` Aaron Jensen
2023-04-30 13:25 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-30 14:25   ` Aaron Jensen
2023-04-30 14:42     ` Eli Zaretskii
2023-04-30 14:57       ` Aaron Jensen
2023-04-30 15:26         ` Eli Zaretskii
2023-04-30 16:48           ` Aaron Jensen
2023-04-30 19:04             ` Eli Zaretskii
2023-04-30 23:58     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-01 12:40       ` Eli Zaretskii
2023-05-01 13:18         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-01 13:25           ` Eli Zaretskii
2023-05-01 13:47             ` Aaron Jensen
2023-05-01 13:52               ` Eli Zaretskii
2023-05-01 13:55                 ` Aaron Jensen
2023-05-01 14:06                   ` Aaron Jensen
2023-05-09  3:07               ` Aaron Jensen
2023-05-09  5:39                 ` Eli Zaretskii
2023-05-13 13:54                   ` Eli Zaretskii
2023-05-13 14:23                     ` Aaron Jensen
2023-05-18 11:21                       ` Eli Zaretskii
2023-05-18 15:59                         ` Aaron Jensen
2023-06-08  5:40                           ` Kai Ma
2023-06-08  7:33                             ` Kai Ma
2023-06-08 12:51                               ` Alan Third
2023-06-08 13:42                                 ` Kai Ma
2023-06-08 14:57                                   ` Kai Ma
2023-06-08 17:22                                     ` Alan Third
2023-06-09  2:42                                       ` Kai Ma
2023-06-09  2:47                                         ` Aaron Jensen
2023-06-09  3:12                                           ` Kai Ma
2023-06-09 18:27                                             ` Alan Third
2023-06-09 18:46                                               ` Aaron Jensen
2023-06-09 20:00                                                 ` Alan Third
2023-06-12 13:04                                                   ` Aaron Jensen
2023-06-16  2:17                                                     ` Aaron Jensen
2023-06-19 15:46                                                       ` Aaron Jensen
2023-06-24  4:17                                                         ` Kai Ma
2023-06-24 13:34                                                           ` Aaron Jensen
2023-06-24 14:14                                                             ` Alan Third
2023-06-24 14:52                                                               ` Aaron Jensen
2023-06-24 15:08                                                                 ` Eli Zaretskii
2023-06-24 15:41                                                                 ` Alan Third
2023-06-24 16:05                                                                   ` Aaron Jensen
2023-06-24 21:29                                                                     ` Alan Third
2023-06-24 21:43                                                                       ` Aaron Jensen
2023-06-25 12:46                                                                         ` Alan Third
2023-06-25 17:07                                                                           ` Aaron Jensen
2023-06-25 18:17                                                                             ` Alan Third
2023-06-25 19:07                                                                               ` Aaron Jensen
2023-06-25 21:18                                                                                 ` Alan Third
2023-06-25 22:33                                                                                   ` Aaron Jensen
2023-06-26  7:27                                                                           ` Kai Ma
2023-06-28 19:53                                                                             ` Alan Third
2023-07-21  2:02                                                                               ` Aaron Jensen
2023-07-23 11:20                                                                                 ` Alan Third
2023-07-23 13:01                                                                                   ` Aaron Jensen
2023-07-25 14:47                                                                                     ` Aaron Jensen
2023-07-25 15:45                                                                                       ` Eli Zaretskii
2023-06-23  8:48                                                       ` Alan Third
2023-06-23 11:54                                                         ` Aaron Jensen
2023-05-01 17:26             ` Alan Third [this message]
2023-05-01 22:40               ` Aaron Jensen
2023-05-02 10:14                 ` Alan Third
2023-05-02 12:21                   ` Eli Zaretskii
2023-05-02 22:36                     ` Alan Third
2023-05-03  8:11                       ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-03 13:08                       ` Eli Zaretskii
2023-05-02  0:07               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-02  0:32                 ` Aaron Jensen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZE/2PF7chXbWWZEG@idiocy.org \
    --to=alan@idiocy.org \
    --cc=63187@debbugs.gnu.org \
    --cc=aaronjensen@gmail.com \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).