| Ticket UUID: | 1924761 | |||
| Title: | Accented characters appearing at the end of the line | |||
| Type: | Bug | Version: | obsolete: 8.6b1.1 | |
| Submitter: | fibonacciprower | Created on: | 2008-03-24 23:52:01 | |
| Subsystem: | 67. Unix Window Operations | Assigned To: | dkf | |
| Priority: | 8 | Severity: | ||
| Status: | Closed | Last Modified: | 2010-01-04 03:25:09 | |
| Resolution: | Fixed | Closed By: | dkf | |
| Closed on: | 2010-01-03 20:25:09 | |||
| Description: |
Whenever a Tcl/Tk program that has a text widget in it freezes, all input characters that have been typed with a dead key appear at the end of the line upon unfreezing of the program, regardless of where they were actually typed. Furthermore, all the characters that appear are equal to the last accented character typed. For example (assuming the acute and grave accents require dead keys for input): typing "déjà-vu" while the program is frozen, would result in "dj-vuàà" appearing upon unfreezing. I have reported this bug again since it appears that the previous bug cannot be updated. | |||
| User Comments: |
dkf added on 2010-01-04 03:25:09:
allow_comments - 1 Already on the 8.5 branch. (That particular fix was initially developed against 8.5 as it happens, unlike the other part which was done vs the HEAD first. I don't recommend trying to work from my patches, but rather from our repository.) Vivia, if you still have issues can you open a new bug report? This one's getting long and it would be better to work from where we've got to than where we were before. And bug DB entries are really cheap. :-) fibonacciprower added on 2010-01-03 09:33:01: Will we see the fix backported to 8.5? fibonacciprower added on 2010-01-03 04:46:26: Works for me. Thank you! dkf added on 2010-01-03 04:27:21: i.e., it's attached here for reference and review purposes only dkf added on 2010-01-03 04:26:53: The patch is already applied. fibonacciprower added on 2010-01-03 03:49:40: I couldn't apply your patch - I keep getting messages like this: Reversed (or previously applied) patch detected! Assume -R? [n] Apply anyway? [n] Perhaps I misunderstood. Am I not supposed to apply this patch to the latest CVS version? dkf added on 2010-01-03 00:09:20: I need to know what's going awry. With the different XIM engine I've got, it all works but there's no way to change it. vivia added on 2010-01-02 23:58:53: Hi, Cheers, it almost works :) With XIM disabled, it works perfectly. With XIM enabled, accented characters work _only_ if Tk is not busy. If Tk is busy, they disappear completely. Stupid XIM ☹ FWIW, I have a dual US/Greek keyboard (using XKB), and on top of that I'm running UIM for Japanese. I have deadkeys for Greek accented characters, and I can type non-greek accented characters with the Compose key. patthoyts added on 2010-01-02 23:54:58: allow_comments - 0 dkf added on 2010-01-02 18:09:58: BTW, I'm not backporting this to 8.4. I can't be bothered. dkf added on 2010-01-02 18:09:05: allow_comments - 1 Fixed on HEAD. (Converting the supplied patch is a little involved due to some code reorganizations; you're better just updating to the HEAD.) dkf added on 2010-01-02 17:45:57: File Added - 357413: xim_cache.patch dkf added on 2010-01-02 17:45:13: Fixed on 8.5 (OMG! This was a nasty problem.) Patch attached. dkf added on 2010-01-02 07:29:07: What we suspect is that the input method is only remembering a limited amount of state for which key is being processed, and that's getting overwritten by subsequent queued events. Determining whether that's really what's going on is hard enough that I'm not going to bother; it *smells* like the problem and that's good enough for me for now. (Fixing the other thing from the patch attached earlier was a prerequisite for tackling this BTW.) I hope to have a fix this weekend. It's a little involved because there's a lot of bits to change but I think I grok enough to do it now. fibonacciprower added on 2010-01-02 07:22:36: Q1: But it's not only normal ASCII which appears correctly. For example, with a Spanish keyboard I can enter ñ and ç with a single keystroke, and so, something like "niño, criança" appears as it should instead of e.g. "niço, criança". Also, what if I'm using UIM or SCIM? Is it irrelevant simply because I'm using X11? Q2: I think I understand. Will there be a fix for that anytime soon? dkf added on 2010-01-02 07:14:55: To Q1: XIM is very complex, and normal ASCII is probably treated specially. To Q2: It has to do with *when* particular steps in the processing of events are done; Tk currently does them later than it probably should. fibonacciprower added on 2010-01-02 07:00:35: Sorry, I meant "those", not "whose". fibonacciprower added on 2010-01-02 07:00:13: Why doesn't that affect plain unaccented characters and whose which can be entered with a single keystroke? (e.g. "sphynx" will come out as "sphynx", not "xxxxxx") Also, why doesn't that affect every single toolkit, instead of just Tk? dkf added on 2010-01-02 06:57:06: I suspect that a sane fix for 1373712 could tackle this issue too. dkf added on 2010-01-02 06:54:25: I can't reproduce, but then I'm not on X11 so it's a totally different code-path anyway and so my failure to reproduce is unrelated. :-) I'm advised that the problem is that the problem is that the input method engine (not part of Tk) holds the character in its state, and Tk needs to ask for it. It only does that when it processes the event in the binding script, by which time the character's been overwritten. Ouch. fibonacciprower added on 2010-01-02 06:15:15: I can't see how is that possible, either - but then I don't know anything about Tcl/Tk. The fact is, it does happen. fibonacciprower added on 2010-01-02 06:14:14: I type fast.
Also, the program I posted on 2008 gives me plenty of time to get all those events in while Tk is frozen. If the time is not enough you can increase it:
destroy .t
pack [text .t]
after 5000 {
for { set i 0 } { $i < 500000 } { incr i } { puts test }
}
That should give you enough time to input as many accented characters as you want.
dkf added on 2010-01-02 06:12:43: To be exact, I can't see how a correct character typed earlier could then be edited to a wrong one later unless there's something else totally wrong. dkf added on 2010-01-02 06:11:40: How the heck are you managing to get all those events in at once? dkf added on 2010-01-02 06:11:02: Applied to HEAD and tip of 8.5 branch. What it does is move the XFilterEvent call to where it should always have been. (This also fixes a few other issues.) This increases the sanity of the event processing system (a little). It might sometimes get the focus handling wrong though (but fixing that requires a restructure of the entire event handling engine, so not today). fibonacciprower added on 2010-01-02 06:08:27: The patch doesn't fully fix this problem. The accented characters appear now in the right place, but all are still equal to the last one typed. So for example "déjà-vu" appears as "dàjà-vu", and "úíúíúíúíúíúíúíúí" appears as "íííííííííííííííí". vivia added on 2010-01-02 05:14:44: Patch WORKS :) @fibonacci: It's against current tcl/tk cvs head. fibonacciprower added on 2010-01-02 04:45:46: Which version is that patch for? dkf added on 2010-01-02 04:30:29: Can someone try the attached patch? It moves all XFilterEvent processing to the correct location while still handling focus redirection. dkf added on 2010-01-02 04:29:39: File Added - 357360: xim.patch dkf added on 2010-01-02 02:55:04: I suspect an odd interaction between the event stream that X{mb,utf8}LookupString wants and the events that Tk delivers to it. Or maybe incorrect processing of the status value returned.
vivia added on 2010-01-01 23:40:29: Happy New Year :) I made some progress here: in tkUnixKey.c , in TkpGetString , i changed the #ifdef TK_USE_INPUT_METHODS to #ifdef TK_USE_INPUT_METHODS_DELME and plain ascii letters appeared correctly. Of course, this only hits my XIM-causing-keyboard-lag issue and not the accented characters issue. I think it's something about the variable return time of TkpGetString (or TkpGetChar). However, trying to search more, I got lost in the code. Any help would be highly appreciated. ☺ fibonacciprower added on 2009-12-01 03:53:16: Sometimes, when the CPU usage is at 100% for some time, on aMSN, the accented characters simply do not appear, or perhaps they appear on some other text widget which was selected *after* I typed the whole text. fibonacciprower added on 2009-11-01 02:36:20: Yes, I have reproduced the problem with a US-international keyboard layout. However, I haven't so far had any problem with plain ASCII characters, neither on SCIM nor on UIM. Are you using a Greek or US keyboard layout? vivia added on 2009-09-22 05:22:29: Using KUbuntu Jaunty. Without SCIM/UIM, it only happens with accented characters, as stated. It persists in 8.5.6, shall I test 8.6 as well? Someone mentioned that it does persist. I believe that you will reproduce the problem if you use US-international as your keyboard layout. You also can install either scim or uim. As soon as the xim bridge starts running, ALL characters get delayed and appear at a semi-random order, making it impossible to type. Using aMSN with a webcam chat is almost sure to reproduce the problem as well. fibonacciprower added on 2009-02-01 09:07:41: Apparently something in your configuration is preventing the bug from being triggered in your system. Try the following, which has worked 100% of the times I've tried it:
1- Get an Ubuntu 8.04 or 8.10 liveCD for 32-bits processors.
2- While booting, choose a keyboard layout with dead keys, e.g. US-International if available, or Spanish.
3- Either download/compile the sources for Tcl/Tk (CVS version or current stable), or install them via apt.
4- run the following script on a wish shell:
destroy .t
pack [text .t]
after 5000 {
for { set i 0 } { $i < 100000 } { incr i } { puts test }
}
5- While the program is frozen, not before and not after, type a string with accenter characters, such as "déjà-vu", USING THE DEAD KEYS. Using a compose key might work in that scenario, but I haven't tried it so I don't know for sure - dead keys are the only sure way to trigger the bug.
6- Wait for the program to unfreeze. You'll see that the string which finally appears on the text widget is different from the one typed ("dj-vuàà", in the aforementioned example). You will have replicated this bug.
[email protected] added on 2008-11-12 12:39:45: Of course it is. The problem is triggered by DEAD keys, not compose keys. jenglish added on 2008-11-12 11:38:39: > To replicate, run the following script [...] I have; I just don't observe the reported behavior. This may be because I have a US keyboard with no "dead keys"; to type accented characters I have to add a Compose key with `xmodmap -e 'keysym Super_L = Multi_key Super_L' ` and then use e.g., [Windows-Key] a ' to get á. [email protected] added on 2008-11-12 10:13:24: To replicate, run the following script on a wish shell (under Ubuntu, Fedora, or any other distro on which the bug has been observed):
destroy .t
pack [text .t]
after 5000 {
for { set i 0 } { $i < 100000 } { incr i } { puts test }
}
When the program freezes, start trying to input the accented characters using dead keys.
jenglish added on 2008-11-12 06:25:11: Still can't replicate. Sorry, I don't know how to proceed tracking this down. fibonacciprower added on 2008-09-24 12:41:20: Just tested in the CVS version (info patchlevel gives 8.6a3), and the bug is still there. [email protected] added on 2008-05-18 19:38:51: Logged In: NO After removing every trace of UIM left on my system (I think I'm using SCIM now), the problem is still there. Apparently it's not an UIM problem. fibonacciprower added on 2008-05-05 02:09:02: Logged In: YES user_id=1856163 Originator: YES Yes it is the same. It does persist under Tk 8.5.2. I'm using Ubuntu GNU/Linux 8.04, and I think I'm using UIM, but I'm not sure. How can I determine the input method and its settings? jenglish added on 2008-05-05 00:43:44: Logged In: YES user_id=68433 Originator: NO Is this the same as #1505182? Does the problem persist under Tk 8.5.2? I have not been able to replicate the problem. Could you provide more details about what IM manager you are using (SCIM, UIM, etc) and what the IM settings are? What OS/distro/version? | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki