Ticket #40959

le-no-conv-meta should be default

Date d'ouverture: 2020-11-14 10:26 Dernière mise à jour: 2020-11-18 06:45

Rapporteur:
(Anonyme)
Propriétaire:
Type:
État:
Ouvert [Owner assigned]
Composant:
Jalon:
(Aucun)
Priorité:
3
Sévérité:
3
Résolution:
Aucun
Fichier:
Aucun
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Détails

without the default .yashrc, yash defaults to set --le-conv-meta which causes havoc when accidentally hitting a non-ascii character on the keyboard. it took me about an hour single-stepping in gdb to find out what was the cause of this behaviour.

read_next () at lineedit.c:199
199         le_display_flush();
(gdb) 
202         switch (wait_for_input(STDIN_FILENO, reader_trap,
(gdb) 
205                 switch (read(STDIN_FILENO, &c, 1)) {
(gdb) n
229                 if (has_meta_bit(c)) {
(gdb) p c
$2 = -61 '\303'
(gdb) n
230                     sb_ccat(&reader_first_buffer, ESCAPE_CHAR);
(gdb) n
231                     sb_ccat(&reader_first_buffer, c & ~META_BIT);
(gdb) 
193         bool timeout = false;
(gdb) 
248         if (incomplete_wchar || le_next_verbatim)
(gdb) p incomplete_wchar
$3 = false
(gdb) n
252         keycode_ambiguous = false;
(gdb) 
253         while (reader_first_buffer.length > 0) {
(gdb) p reader_first_buffer
$4 = {contents = 0xee7420 "\033C", length = 2, maxlength = 15}
(gdb) p/x L'ö'
Invalid character constant.
(gdb) p/x L"ö"
$5 = {0xf6, 0x0}
(gdb) p/d 0xf6
$6 = 246
(gdb) p/d (signed char)0xf6
$7 = -10
(gdb) p/x '\303'
$8 = 0xc3
(gdb) p/x META_BIT
No symbol "META_BIT" in current context.
(gdb) n
255             int firstchar = (unsigned char) reader_first_buffer.contents[0];
(gdb) 
257             if (firstchar == le_interrupt_char)
(gdb) p firstchar
$9 = 27
(gdb) p/x firstchar
$10 = 0x1b
(gdb) p reader_first_buffer.contents
$11 = 0xee7420 "\033C"
(gdb) p/x reader_first_buffer.contents[0]
$12 = 0x1b
(gdb) p/x reader_first_buffer.contents[1]
$13 = 0x43
(gdb) p/c reader_first_buffer.contents[1]
$14 = 67 'C'
(gdb) l has_meta_bit
394     }
395
396     /* Tests if the specified character has the meta flag set. */
397     bool has_meta_bit(char c)
398     {
399         switch (shopt_le_convmeta) {
400             case SHOPT_YES:
401                 break;
402             case SHOPT_NO:
403                 return false;
(gdb) 
404             case SHOPT_AUTO:
405                 if (le_meta_bit8)
406                     break;
407                 else
408                     return false;
409         }
410         return (c & META_BIT) != 0;
411     }

btw, it would be great if it was possible to file issues in github too. i've actually considered open a bogus pull request just to contact you there. there's also an irc channel on freenode which i'm currently in in case you wanna have a chat with me, since i will not register here and therefore won't see any replies. thanks!

Ticket History (3/8 Histories)

2020-11-14 10:26 Updated by: None
  • New Ticket "le-no-conv-meta should be default" created
2020-11-14 22:37 Updated by: magicant
  • Details Updated
2020-11-14 22:59 Updated by: magicant
  • Sévérité Update from 7 to 3
  • Priorité Update from 5 - moyen to 3
Commentaire

without the default .yashrc, yash defaults to set --le-conv-meta

This is not true. The --le-conv-meta and --le-no-conv-meta options (which are different options) are both disabled by default.

Although the default option (without the common yashrc) could be confusing for some users, I'm not very willing to change the default. The root cause of this issue is that the system's terminfo is giving the wrong data about your terminal. Enabling the --le-no-conv-meta option inherently would break on systems where the terminfo is correct and the meta flag needs to be handled.

2020-11-15 07:15 Updated by: None
Commentaire

The root cause of this issue is that the system's terminfo is giving the wrong data about your terminal

oh ? what would be the correct data? doesn't utf-8 data have to have bit 8 set in the first char?

2020-11-15 15:10 Updated by: magicant
Commentaire

When you use an 8-bit character encoding, the terminfo's km capability data should be false, otherwise the 8th bit is treated as a modifier for the escape character.

2020-11-16 05:24 Updated by: None
Commentaire

hmm, i can't find a single entry for 'km=' in ncurses 6.2 terminfo database: https://0x0.st/i5N6.src

2020-11-16 21:10 Updated by: magicant
Commentaire

km is a Boolean capability, so there's no value to assign to it. You should search for km, in that file.

2020-11-18 06:45 Updated by: None
Commentaire

this seems to be a really hard problem, not even specialists seem to know how to deal with it: https://github.com/magiblot/turbo/issues/6#issuecomment-727284872

so xterm has the km capability set in terminfo, what would be your suggestion? that it gets generally removed in terminfo, or that xterm or ncurses somehow removes it from capabilities when xterm is put into utf-8 mode?

btw i opened another issue which didnt get any reply ( https://osdn.net/projects/yash/ticket/40964 ), i would be grateful for your comments.

Attachment File List

No attachments

Modifier

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion