all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jared Finder via "Emacs development discussions." <emacs-devel@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "jared--- via \"Emacs development discussions.\"" <emacs-devel@gnu.org>
Subject: Re: Additional xterm-mouse cleanup
Date: Wed, 24 Feb 2021 22:08:21 -0800	[thread overview]
Message-ID: <d440be02f3f174566f933a7ecd3b740f@finder.org> (raw)
In-Reply-To: <jwv4ki0kdzu.fsf-monnier+emacs@gnu.org>

On 2021-02-24 7:56 pm, Stefan Monnier wrote:
> 
>> Ah, got it. I agree, it is mostly straightforward. To do this properly
>>  required making an assumption that .timestamp=0 for 
>> SELECT_WINDOW_EVENT is
>>  ok. Looking through the C code, I don't see any location that reads
>>  .timestamp for the SELECT_WINDOW_EVENT, so I make it uniformly
>>  0 throughout.  Updated patch attached.
> 
> Looks good to me.

Thank you.  If it's okay, I'd like it if the two, now simple, patches 
could be merged now before the third one, as this third one will take 
some time.

>>>>> [ Oh ... how I hate that echo area code.  ]
>>> I have the impression that a whole lot of code can run between the
>>> `clear_message` and your code, so I don't immediately see why we can 
>>> be
>>> sure that `echo_area_buffer[1]` indeed always contains the thing 
>>> before
>>> the `clear_message`.  And if it doesn't, then maybe we shouldn't try 
>>> to
>>> revert the echo message.
>> 
>> Good point. I will update my patch to have a copy of the echo area 
>> made
>> inside read_key_sequence.
> 
> I don't see this in your patch, so I assume it'll be in a subsequent 
> patch.

Yup!

>> To delay until we're sure, we'd need to have some sort of
>> assumption of how terminal escape sequences are received that normal 
>> humans
>> would never do. Consider that the following key sequence is a mouse 
>> movement
>> escape sequence but is completely possible for a human to type slowly:
>> 
>> ESC [ < 3 5 ; 1 9 ; 3 4 m
>> 
>> What should the echo area display if it has read "ESC ["? At this 
>> point,
>> input-decode-map still doesn't know if this is a xterm escape sequence 
>> or
>> not.
> 
> Right, so indeed the best we can do is to record the clear in such a 
> way
> that we can undo it as faithfully as possible.  This also begs the 
> question
> of what I mean by "*the* clear" since there's presumably going to be 
> one
> clear per byte in the above sequence.

I don't think remembering per input character is needed. Just one value 
is sufficient because the only case that needs to be handled is 
restoring the echo state when mock_input would be 0.

Consider what *should* happens when if, for example, the input is:

C-x 8 ESC [ < 3 5 ; 1 9 ; 3 4 m

The mouse movement escape sequence will be stripped, mock_input will be 
set to 2, and the code will goto replay_sequence.  At this point, one of 
two things should happen:

a) If this was done faster than `echo-keystrokes', the echo area should 
be empty as pressing a key clears the echo area.
b) If this was done slower than `echo-keystrokes', the echo area should 
display "C-x 8-" as waiting after pressing a key displays the keys typed 
in.

Both of the above will happen based on the existing logic of calling 
add_command_key() followed by echo_now() when mock_input is non-zero.  
The only case this does not handle is when mock_input is zero, hence 
that's the case to restore to.

   -- MJF



  reply	other threads:[~2021-02-25  6:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  6:32 Additional xterm-mouse cleanup jared--- via Emacs development discussions.
2021-01-28 14:25 ` Stefan Monnier
2021-02-02  8:24   ` jared--- via Emacs development discussions.
2021-02-02 14:37     ` Stefan Monnier
2021-02-04  6:54       ` jared--- via Emacs development discussions.
2021-02-15  1:02         ` Jared Finder via Emacs development discussions.
2021-02-25  3:56         ` Stefan Monnier
2021-02-25  6:08           ` Jared Finder via Emacs development discussions. [this message]
2021-02-25 13:52             ` Stefan Monnier
2021-01-30  9:38 ` Eli Zaretskii
2021-02-02  8:28   ` jared--- via Emacs development discussions.
2021-02-02 15:08     ` Eli Zaretskii
2021-02-04  6:57       ` jared--- via Emacs development discussions.
2021-02-04 15:04         ` Eli Zaretskii

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=d440be02f3f174566f933a7ecd3b740f@finder.org \
    --to=emacs-devel@gnu.org \
    --cc=jared@finder.org \
    --cc=monnier@iro.umontreal.ca \
    /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.