Lister changes keyboard layout on specific RTF

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Lister changes keyboard layout on specific RTF

Post by *MVV »

Problem was posted on Rusian board, I removed extra instructions from RTF file and get this:

Code: Select all

{\rtf1

\plain\ltrch

test

}
Save this file as RTF and view in Lister. For me in TC 7.04a, 7.50a, 7.55b1 keyboard layout changes to Russian when I press F3 on this file.

If I remove \plain or \ltrch, layout preserves.

Is it possible to preserve keyboard layout in all cases?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Strange, from what language does it change to Russian? I have the Russian locale installed too (XP Pro), and it doesn't switch from German to Russian.

As i see it, this seems to be caused by the Richedit control used by TC (part of Windows itself). I cannot find anything in the Richedit documentation which allows to turn it off. Any ideas?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Layout switches from EN to RU.

I have no ideas, I even didn't see this until it was reported as 'old bug'.

BTW, when I open file in WordPad, layout doesn't change from EN to RU.


Added: on Russian board one user said that he has EN, BE, RU and DE (last installed for tests), and during opening this file layout always switches from EN or DE to BE or RU.

Maybe it needs russian codepage installed in Windows to reproduce bug?
User avatar
Hacker
Moderator
Moderator
Posts: 13065
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

I confirm, it switches from EN to SK (Slovak) here. No Russian anything installed here.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

BTW if system codepage changed from Russign to English, situation reverses - layout is switches from RU and BE to DE etc...
Last edited by MVV on 2010-03-26, 22:22 UTC, edited 2 times in total.
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

I can confirm too, it switches from AR (Arabic) to EN

This definitely caused by the RichEdit control not TC.
MVV wrote:when I open file in WordPad, layout doesn't change from EN to RU.
In WordPad (for XP) if you pressed <Home> or <End> the keyboard layout will be switched, so maybe TC send one of these keys to the RichEdit control after loading the file and that what causing the keyboard layout switch.

Anyway I don't see any problem as RichEdit control switch the keyboard layout according to the codepage of the character under the cursor, for example if you press F3 on Register.rtf in TC folder, your keyboard will switch from RU to EN.
Last edited by ts4242 on 2010-03-26, 22:35 UTC, edited 1 time in total.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I found a flag for RichEdit control that allows to switch or not to switch layout!

Code: Select all

#define IMF_AUTOKEYBOARD		0x0001
Language flags for RichEdit may be received and changed using SendMessage function:

Code: Select all

int flags=SendMessage(hEdit, EM_GETLANGOPTIONS, 0, 0);
SendMessage(hEdit, EM_SETLANGOPTIONS, 0,  flags);
And for Lister's TRichEdit this flag is set by default (flags=0x83), but when I've removed it (set flags to 0x82), layout didn't switch anymore! =)

So simple solution is to remove flag before loading RTF document:

Code: Select all

SendMessage(hEdit, EM_SETLANGOPTIONS, 0,  SendMessage(hEdit, EM_GETLANGOPTIONS, 0,  0)&~IMF_AUTOKEYBOARD);
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2MVV
Nice, thanks for finding that! It seems to work when setting it AFTER loading the actual file, because the loading seems to change these flags depending on the file contents...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler(Author) wrote:It seems to work when setting it AFTER loading the actual file, because the loading seems to change these flags depending on the file contents...
If I set this flag to Lister's TRichEdit and load new file using File\Open then, all works fine - so I think loading doesn't change flags. But you may always try and get see if it works as should. :)
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

Confirm that the problem is fixed in 7.55pβ2.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

Fixed in 7.55 beta 2.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks! MVV or anyone else, can you confirm it?
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler(Author) wrote:Thanks! MVV or anyone else, can you confirm it?
Yes, thanks.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks!
Author of Total Commander
https://www.ghisler.com
Post Reply