Subject: Re: bug#57434: 28.1.91; Terminal Emacs Mac OS flickering.

From: Eli Zaretskii <[email-masked]>
Date: Thu, 08 Sep 2022 12:16:07 +0300

> From: Gerd Möllmann <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Thu, 08 Sep 2022 10:43:49 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > What is P1 and what is P2?
> 
> The two proposals that we know of.
> 
> >
> >> I installed iTerm2 just now, which implements P2 at least.  iTerm2 has a
> >> preference options to switch GPU acceleration on/off.  iTerm2 uses
> >> TERM=xterm256-color, independent of the GPU setting.  So matching TERM
> >> wouldn't work with iTerm2.  The query control sequence of P2 seems to
> >> return if GPU accel is on or off on iTerm2.
> >
> > What is the "query control sequence"?
> 
> Proposal P2 defines 3 control sequences.  In addtion to begin/end, it
> contains a control sequence to determine the status of synchronized
> updates: on, off, permanently on, permanently off (AFAIU).

I guess by P1 you mean these two sequences:

  BSU: ESC P = 1 s ESC \
  ESU: ESC P = 2 s ESC \

whereas by P2 you mean these:

  DECRQM: ESC [ ? 2026 $ p
  DECRPM: ESC [ ? 2026 ; n $ y  (with n = 0..4, and 0 or 4 means "no support")
  BSU:    ESC [ ? 2026 h
  ESU:    ESC [ ? 2026 l

> > Do you happen to know where is the definitive documentation of Sync?
> 
> Sorry, I don't know a definitive documentation.

And any documentation at all?

Anyway, given the problems usually related to querying terminals about
potentially unsupported features, and the general mess in this field,
I think our best bet is to have a function that could switch the
frame-update hooks between these 3 states:

  . unused
  . used with P1 BSU/ESU sequences
  . used with P2 BSU/ESU sequences

WDYT?