emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Additional xterm-mouse cleanup


From: Stefan Monnier
Subject: Re: Additional xterm-mouse cleanup
Date: Wed, 24 Feb 2021 22:56:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Sorry for not answering earlier.

> 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.

>>>> [ 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.

>> I agree it doesn't seem easy, but in my experience "do and later undo"
>> sooner or later leads to extra difficulties so I tend to prefer "delay
>> the do until we're sure we want to perform it".
> I completely agree with the sentiment, but I do not think it is the right
> tradeoff. 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.

> Or to use a metaphor: this feels like you're asking for heart bypass surgery
> before putting a bandage over a cut on Mr. Echo Area's elbow.

Actually, I suspect it's worse than bypass surgery, because it requires
an oracle.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]