After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 158200 - terminal backspace behavior not set to UTF-8 mode
terminal backspace behavior not set to UTF-8 mode
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
0.11.x
Other Linux
: Normal normal
: ---
Assigned To: Behdad Esfahbod
Nalin Dahyabhai
Depends on:
Blocks:
 
 
Reported: 2004-11-13 18:37 UTC by Egmont Koblinger
Modified: 2006-07-30 23:32 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
solves the problem for me (437 bytes, patch)
2004-11-13 19:13 UTC, Egmont Koblinger
none Details | Review

Description Egmont Koblinger 2004-11-13 18:37:38 UTC
This bug report is supposed to be a reopening of bug #129317, since that one is
closed, I have no permission to reopen that, but is not yet properly fixed.

Whenever I change to utf8 or 8-bit mode inside the running vte app, either
by escape sequences, or via the menu of gnome-terminal, the IUTF8 stty settings
are changed correctly. (It's a different story that bash likes to revert these
settings but that's nothing vte can do about it...)

However, on startup, if I have an UTF-8 locale, the IUTF8 flag of the terminal
is not set.

vte_terminal_init() calls vte_terminal_set_encoding(), which in turn calls
_vte_pty_set_utf8(), but this time pty_master doesn't yet have its real value,
it is -1, and hence _vte_pty_set_utf8() exits without doing anything. Hence
the initialization fails. _vte_pty_set_utf8() should be called once again when
pty_master has its real value.
Comment 1 Egmont Koblinger 2004-11-13 19:13:01 UTC
Created attachment 33736 [details] [review]
solves the problem for me

Probably not the best way to solve this problem, but at least it works for me.
Comment 2 Behdad Esfahbod 2006-07-10 19:25:44 UTC
Can you write a patch to remember the utf8 state and make the proper call during fork?
Comment 3 Behdad Esfahbod 2006-07-10 19:27:12 UTC
Humm, thinking again, this probably should be closed as OBSOLETE, right?  Backspace works correctly these days.  Reopen if I'm wrong.
Comment 4 Egmont Koblinger 2006-07-11 11:58:15 UTC
vte 0.12.2 is buggy. Here's how to test it: set your locale to UTF-8 (e.g. export LC_ALL=en_US.UTF-8), start vte (or g-t --disable-factory), here launch the "cat" command. Type a few accented letters, press backspace several times and press Enter. The line echoed back will not be the same at the one you've edited: every backspace only removed one byte instead of one whole multibyte character from the kernel's tty buffer. Here's a screenshot if I type áéí and then press two backspaces followed by the Enter:
$ cat
á
áé
$

The expected screenshot (vte with my patch) is of course this:
$ cat
á
á
$

PS. I don't really understand your request with the fork.
Comment 5 Behdad Esfahbod 2006-07-11 15:08:40 UTC
Ah, very true.

I was asking that instead of your patch, have a variable in terminal->pvt to that is set to true if encoding is set to utf8, and use that in the fork command, instead of your g_get_charset call.
Comment 6 Behdad Esfahbod 2006-07-30 23:32:57 UTC
2006-07-30  Behdad Esfahbod  <behdad@gnome.org>

        Bug 158200 – terminal backspace behavior not set to UTF-8 mode
        Based on patch from Egmont Koblinger

        * src/vte.c (_vte_terminal_setup_utf8),
        (vte_terminal_set_encoding), (_vte_terminal_fork_basic),
        (vte_terminal_set_pty): Make sure UTF-8 state is correctly set
        when pty changes.