~rjarry/aerc-discuss

15 6

aerc 1.14 emacs rendering issues

Details
Message ID
<CRLG5CEC48DM.2W10CERLD08CX@gentoo-zen5900x>
DKIM signature
missing
Download raw message
Hello, as the title says, aerc has some trouble when using GNU Emacs as
message editor. The problem manifests itself as Enter scrolling the entire
terminal and not just Emacs' content, at least until manual repainting is
done (C-l or SIGWINCH).

My environment is the following:
* aerc: 1.14 on Gentoo
* terminal emulator: st, but reproducible on vanilla xterm too
* editor: emacs -nw -q -Q (i.e. vanilla Emacs 28.3, no init file loaded)

Here is a small video of the phenomenon: http://0x0.st/HHOO.mkv

Does anyone have a clue? I switched to the lighter mg in the meantime.
Details
Message ID
<D0ZXM85PMT9Z.2AF3J9RRBJIAW@posteo.de>
In-Reply-To
<CRLG5CEC48DM.2W10CERLD08CX@gentoo-zen5900x> (view parent)
DKIM signature
pass
Download raw message
I'm having a similar issue with emacs. This is how I can reproduce it reliably:

  - In an empty mail body, enter 8 ASCII characters. It doesn't matter which
    ones. We'll go with "12345678".

  - The expected cursor position would be after "8", but it is one character
    before that, indicating that typing another character inserts between "7"
    and "8".

  - If you move the cursor to the right (by pressing <right> or <c-f>), this has
    seemingly no effect. Pressing <left> or <c-b> afterwards also seems to have 
    no effect.

  - But everything was actually entered correctly, it's just displayed
    wrong. <c-l> or <enter> fixes the line and displays everything as it was
    typed.

  - This happens independently of the terminal emulator. I tried alacritty,
    xterm and urxvt.

And now the weird part: The culprit was the following line in my ~/.emacs.d/init.el:

    (setq mode-line-position '("%l:%c"))

Commenting out this line fixed the issue for me. I have no idea why it is
relevant, but my hunch is that Emacs utilizes some advanced escape sequence
magic that aerc hasn't implemented.
Details
Message ID
<D0ZY0AH8J9CO.1VSSA7L57PJFN@ringo>
In-Reply-To
<D0ZXM85PMT9Z.2AF3J9RRBJIAW@posteo.de> (view parent)
DKIM signature
pass
Download raw message
Folks, did you try with the latest master?

We changed the vterm implementation entirely.
Details
Message ID
<D101H745I5HV.202EVD9USAZNW@posteo.net>
In-Reply-To
<D0ZY0AH8J9CO.1VSSA7L57PJFN@ringo> (view parent)
DKIM signature
pass
Download raw message
Hello, still broken using latest git and editor='emacs -nw -Q -q'. Simply playing
with spaces, tabulation, C-{Left,Right}, Home/C-a, End/C-e and the minibuffer makes
the cursor jumps around randomly.
Details
Message ID
<c7ba35c7-13d7-4b2b-97da-504140a82334@sloti42n25>
In-Reply-To
<D101H745I5HV.202EVD9USAZNW@posteo.net> (view parent)
DKIM signature
pass
Download raw message
On Fri, 03 May 2024 08:21:29 CDT, q3cpma@posteo.net wrote:
> Hello, still broken using latest git and editor='emacs -nw -Q -q'. Simply playing
> with spaces, tabulation, C-{Left,Right}, Home/C-a, End/C-e and the minibuffer makes
> the cursor jumps around randomly.

Can you verify the aerc version you are using? There was a bug regarding tab
stops in the vterm which is fixed on aerc master and sounds like the bug
described.

-- 
Tim
Details
Message ID
<D11PA2BN4PUE.2R4ROP0NRDBOE@posteo.net>
In-Reply-To
<c7ba35c7-13d7-4b2b-97da-504140a82334@sloti42n25> (view parent)
DKIM signature
pass
Download raw message
On Sun May 5, 2024 at 1:55 PM CEST, Tim Culverhouse wrote:
> On Fri, 03 May 2024 08:21:29 CDT, q3cpma@posteo.net wrote:
> > Hello, still broken using latest git and editor='emacs -nw -Q -q'. Simply playing
> > with spaces, tabulation, C-{Left,Right}, Home/C-a, End/C-e and the minibuffer makes
> > the cursor jumps around randomly.
>
> Can you verify the aerc version you are using? There was a bug regarding tab
> stops in the vterm which is fixed on aerc master and sounds like the bug
> described.

> ./aerc -v
aerc 0.17.0-122-g7b4c8f67eb5f (go1.22.2 amd64 linux 2024-05-03)

Here's a small video of the problem. On the first line, I navigate solely by arrow keys:
http://0x0.st/XXk-.mkv
Details
Message ID
<51ad75db-96f7-4ce9-a375-3aeac7fd5d09@sloti42n25>
In-Reply-To
<D11PA2BN4PUE.2R4ROP0NRDBOE@posteo.net> (view parent)
DKIM signature
pass
Download raw message
On Sun, 05 May 2024 07:13:11 CDT, q3cpma@posteo.net wrote:
> aerc 0.17.0-122-g7b4c8f67eb5f (go1.22.2 amd64 linux 2024-05-03)
> 
> Here's a small video of the problem. On the first line, I navigate solely by arrow keys:
> http://0x0.st/XXk-.mkv

Thanks for the video, I can reproduce. I'll take a look
Details
Message ID
<bfb4307e-c71d-420b-8571-f54fe4a11940@sloti42n25>
In-Reply-To
<D11PA2BN4PUE.2R4ROP0NRDBOE@posteo.net> (view parent)
DKIM signature
pass
Download raw message
Can you pull the latest vaxis in your aerc repo? I am unable to reproduce with
that (there was a change to the timer / dirty handling for the vterm that looks
to be the issue).

  `go get git.sr.ht/~rockorager/vaxis@main`
Details
Message ID
<D11PO8XZZ4H2.18869YTUDBDPR@cepl.eu>
In-Reply-To
<c7ba35c7-13d7-4b2b-97da-504140a82334@sloti42n25> (view parent)
DKIM signature
pass
Download raw message
On Sun May 5, 2024 at 1:55 PM CEST, Tim Culverhouse wrote:
> On Fri, 03 May 2024 08:21:29 CDT, q3cpma@posteo.net wrote:
> > Hello, still broken using latest git and editor='emacs -nw -Q -q'. Simply playing
> > with spaces, tabulation, C-{Left,Right}, Home/C-a, End/C-e and the minibuffer makes
> > the cursor jumps around randomly.
>
> Can you verify the aerc version you are using? There was a bug regarding tab
> stops in the vterm which is fixed on aerc master and sounds like the bug
> described.

Not sure whether it is the same, but
https://lists.sr.ht/~rjarry/aerc-devel/%3CD0ZG3WLAIOMB.1TLEQKT3UR0OP@cepl.eu%3E
seems pretty much alive and well in 7b4c8f67.

Best,

Matěj
-- 
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
I didn’t attend the funeral, but I sent a nice letter saying
I approved of it.
      -- Mark Twain
Details
Message ID
<D11S3GIJAWA8.18IXN1LVUIHZD@posteo.net>
In-Reply-To
<bfb4307e-c71d-420b-8571-f54fe4a11940@sloti42n25> (view parent)
DKIM signature
pass
Download raw message
On Sun May 5, 2024 at 2:18 PM CEST, Tim Culverhouse wrote:
> Can you pull the latest vaxis in your aerc repo? I am unable to reproduce with
> that (there was a change to the timer / dirty handling for the vterm that looks
> to be the issue).
>
>   `go get git.sr.ht/~rockorager/vaxis@main`

Thanks, this fixes most of the problems I've seen. Two remainings are:
1. The status bar is invsible except for the filename.
2. Mark (C-Space) is invisible.
3. C-h is passed as a backspace to emacs.
4. The completion list at the bottom. Try to type M-x (Alt-x), then enter
  "show-paren-" then Tab, the cursor jumps in the prompt buffer.
5. The highlighting of matching parens sometimes makes the cursor jump around and
  corrupts the rendering until redraw (C-l); this problem is much older than the new
  term impl, though.

  This example line (the length before the opening parens seems important) reproduces
  the problem:
xxhello world (foo bar foo bar)

Video showing 4 and 5: http://0x0.st/XXd9.mkv
Details
Message ID
<D11SKWVSZ8XM.TQFDTBBYX20Q@sindominio.net>
In-Reply-To
<D11S3GIJAWA8.18IXN1LVUIHZD@posteo.net> (view parent)
DKIM signature
pass
Download raw message
Thanks for this list! Here's my two cents (on spacemacs with evil mode):

On 05/05/2024, 16:25, q3cpma wrote:
> 1. The status bar is invsible except for the filename.
I can see the spacemacs' status bar without issues.

> 2. Mark (C-Space) is invisible.
If I deactivate evil mode or while in insert-mode, C-Space gives me a weird
string: "�" (In case it doesn't show like this elsewhere, it's three chars:
ï, ¿, and the one-half fraction char.)

However, the introduction of this escape code breaks my text: I see repeated
lines and I need to go up to the top to make it right.

> 3. C-h is passed as a backspace to emacs.
Not in my case: both with evil disabled and enabled, spacemacs reads C-h
properly (launches help).

> 4. The completion list at the bottom. Try to type M-x (Alt-x), then enter "show-paren-" then Tab, the cursor jumps in the prompt buffer.
While this behaviour is familiar to me (especially in the email address
completion through company), I can't reproduce it right now.

> 5. The highlighting of matching parens sometimes makes the cursor jump around and corrupts the rendering until redraw (C-l); this problem is much older than the new term impl, though.
I can definitely confirm this behaviour.
Details
Message ID
<32474101-2ea6-4b6f-b504-7e2dee245d9c@sloti42n25>
In-Reply-To
<D11S3GIJAWA8.18IXN1LVUIHZD@posteo.net> (view parent)
DKIM signature
pass
Download raw message
On Sun, 05 May 2024 09:25:38 CDT, q3cpma@posteo.net wrote:
> Thanks, this fixes most of the problems I've seen. Two remainings are:
> 1. The status bar is invsible except for the filename.
> 2. Mark (C-Space) is invisible.
> 3. C-h is passed as a backspace to emacs.

What terminal do you use? Some terminals define C-h as backspace and some define
C-? as backspace. Vaxis tries to normalize this by assuming *either* is
backspace, and then when it re-encodes it to the terminal it will always encode
it as C-?. So, for example, if Vaxis reads a 0x08 (C-h) key, it internally says
this is actually 0x7F (C-?). Then the terminal gets the key as a 0x7F and writes
that to the underlying process. That is likely why your C-h is coming through as
a backspace...it's currently impossible (unless you have kitty keyboard) to send
a C-h to the Vaxis terminal.
Details
Message ID
<D11T0N1R2Z8Q.3L5SPFEJHW42U@posteo.net>
In-Reply-To
<32474101-2ea6-4b6f-b504-7e2dee245d9c@sloti42n25> (view parent)
DKIM signature
pass
Download raw message
On Sun May 5, 2024 at 4:55 PM CEST, Tim Culverhouse wrote:
> On Sun, 05 May 2024 09:25:38 CDT, q3cpma@posteo.net wrote:
> > Thanks, this fixes most of the problems I've seen. Two remainings are:
> > 1. The status bar is invsible except for the filename.
> > 2. Mark (C-Space) is invisible.
> > 3. C-h is passed as a backspace to emacs.
>
> What terminal do you use? Some terminals define C-h as backspace and some define
> C-? as backspace. Vaxis tries to normalize this by assuming *either* is
> backspace, and then when it re-encodes it to the terminal it will always encode
> it as C-?. So, for example, if Vaxis reads a 0x08 (C-h) key, it internally says
> this is actually 0x7F (C-?). Then the terminal gets the key as a 0x7F and writes
> that to the underlying process. That is likely why your C-h is coming through as
> a backspace...it's currently impossible (unless you have kitty keyboard) to send
> a C-h to the Vaxis terminal.

I normally use st, but also test with xterm, usually. Did so and both 1 and 2
work on said xterm, don't know how much of this is due to st or something in
vaxis/tcell harcoding xterm stuff in favour of reading terminfo.

C-h is still sent as backspace (even with "Delete is DEL" enabled) and 5 still
happens.
Details
Message ID
<D11T1R5PB4HX.2HPIG0GXZ6YPC@posteo.net>
In-Reply-To
<D11SKWVSZ8XM.TQFDTBBYX20Q@sindominio.net> (view parent)
DKIM signature
pass
Download raw message
On Sun May 5, 2024 at 4:48 PM CEST, inwit wrote:
> Thanks for this list! Here's my two cents (on spacemacs with evil mode):
>
> On 05/05/2024, 16:25, q3cpma wrote:
> > 1. The status bar is invsible except for the filename.
> I can see the spacemacs' status bar without issues.
>
> > 2. Mark (C-Space) is invisible.
> If I deactivate evil mode or while in insert-mode, C-Space gives me a weird
> string: "�" (In case it doesn't show like this elsewhere, it's three chars:
> ï, ¿, and the one-half fraction char.)
>
> However, the introduction of this escape code breaks my text: I see repeated
> lines and I need to go up to the top to make it right.
>
> > 3. C-h is passed as a backspace to emacs.
> Not in my case: both with evil disabled and enabled, spacemacs reads C-h
> properly (launches help).
>

I think it's a good idea to only test vanilla 'emacs -nw -q -Q' to avoid setup
specific issues, at least for now.

Which terminal emulator do you use, by the way?
Details
Message ID
<D11T3T35MYQZ.LZOW6YZOALIA@sindominio.net>
In-Reply-To
<D11T1R5PB4HX.2HPIG0GXZ6YPC@posteo.net> (view parent)
DKIM signature
pass
Download raw message
On 05/05/2024, 17:10,  wrote:
> I think it's a good idea to only test vanilla 'emacs -nw -q -Q' to avoid setup specific issues, at least for now.

You're right, of course.

> Which terminal emulator do you use, by the way?
Foot.
Details
Message ID
<509d1dc9-a64c-40c5-9602-e6d01247e3fd@sloti42n25>
In-Reply-To
<D11T3T35MYQZ.LZOW6YZOALIA@sindominio.net> (view parent)
DKIM signature
pass
Download raw message
On Sun, 05 May 2024 10:13:12 CDT, inwit wrote:
> > Which terminal emulator do you use, by the way?
> Foot.

Ok this explains it. st/xterm don't have kitty keyboard but foot does, which is
why C-h is working for you.

I will need to think of a nice way to handle this internally to Vaxis - possibly
adding a new field on a key event to distinguish between C-h and C-? in legacy
key encodings...

-- 
Tim
Reply to thread Export thread (mbox)