Subject: Re: bug#76064: 31.0.50; Display issue with flymake-show-diagnostics-at-end-of-line

From: Ergus <[email-masked]>
Date: Wed, 5 Feb 2025 16:45:07 +0100

Hi Eli:

Looking at your suggestions I have my opinion I will share just in case
you care:

. don't change anything and live with the minor irregularity in the
    cursor positioning in what I consider to be rare cases
    - variation: turn on truncate-lines in such cases

Given that flymake has the new feature this is not an option. The issue
is pretty annoying and not infrequent at all. I think that this feature
was added because vscode and other editors around already have it, so I
expect it to become popular.

  . don't put the 'cursor' property on the diagnostic, in which case
    C-n will place the cursor after the end of the diagnostic on the
    screen line where the diagnostic ends

Maybe we need an extra property like at-end or something similar, to
indicate that the overlay does not belong to the line at all for
navigation purposes.

  . put the 'cursor' property at the last character of the diagnostic
    string, and have it displayed there

  . calculate the character on which to put the 'cursor' property
    dynamically using some convoluted logic

I don't understand how these two may fix the issue. At least not the 3
symptoms I described in the bug report.

  . implement display of diagnostics in a tooltip instead

IIUC this may be very slow right? How many tooltips will be needed?

I think that we are just missing some property in the overlay that
basically means "this text doesn't exist at all".

Is it really that hard?

On Wed, Feb 05, 2025 at 03:46:45PM +0200, Eli Zaretskii wrote:
>> Date: Wed, 05 Feb 2025 00:24:32 +0100
>> From:  Ergus via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <[email-masked]>
>>
>> I have been using flymake-show-diagnostics-at-end-of-line for a while
>> and I have noticed that the inlined diagnostics behaves wrongly.
>>
>> 1. If I am in a line with a diagnostic at the end, and I do C-e, the
>> cursor goes to the end of the diagnostic instead to the end of the line.
>>
>> 2. If after that I do C-a nothing happens, the cursor "stock" there
>> until I leave the line. Left or right arrow don't work either.
>>
>> 3. If we are in the last line and it has a diagnostic, it is impossible
>> to write at the end of the line because the cursor jumps constantly to
>> the end of the diagnostic when typing.
>
>This is bug#73863.  I explained why this happens in that bug, see
>
>  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73863#35
>
>I proposed several potential solutions for that here:
>
>  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73863#62
>
>(and a couple of other ideas elsewhere in that discussion).  But
>AFAIU, none of the suggestions were acceptable, so here we are.