View Issue Details

IDProjectCategoryView StatusLast Update
0002135Far ManagerKeyboardpublic2012-09-20 08:40
Reportertheultramage Assigned To2useven10  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx64OSWindowsOS Version7
Product Version3.0 
Fixed in Version3.0 
Summary0002135: typing 'shift + letter' diacritic sequence also outputs the + character
DescriptionWhen using the Slovak keyboard layout, it is possible to type characters with the ˇ (caron) diacritic by entering the sequence 'shift' '=' '<letter>'. Since last year, FAR also outputs the '+' character (which is what shift+= maps to on the US keyboard). This is undesirable. Note that strangely, the adjacent sequence 'shift -' for the ´ (acute) symbol does not have this issue.

Listed in the 'additional information' section are versions I tested. That could help you narrow down the revision that caused the problem.
Steps To Reproduce1. Switch to Slovak keyboard layout.
2. Type the 'SHIFT =' combo, followed by, say, the letter 'c'.

Expected output: č
Observed output: +č
Additional Informationversions tested:
Far-3.0.0.2098 (r6425) <- OK
Far-3.0.0.2214 (r6757) <- bug
Far-3.0.0.2627 (r7920) <- bug
Far-3.0.0.2768 (r8261) <- bug
TagsNo tags attached.
Build2809

Relationships

related to 0001832 assignedvskirdin Проблема FarNameToInputRecord / FarInputRecordToName 

Activities

2useven10

2012-07-24 10:08

developer   bugnote:0009428

Last edited: 2012-07-24 10:10

Can't reproduce...
Far3 2768 <- ok
Far3 2772 <- ok

Try to switch off plugins/macros 'far /p /m'

theultramage

2012-07-25 12:14

reporter   bugnote:0009437

Doing that, and deleting all plugins, and deleting my appdata/roaming profile has no impact on the bug. However, I noticed that I'm running slovak locale on an english language pack. When I switch to a different user that doesn't use the language pack, it works there just fine.

When I find the time I'll do build&test runs on various revisions to pinpoint the revision where the behavior changed, and then identify the code that causes it.

2useven10

2012-07-25 12:36

developer   bugnote:0009438

Last edited: 2012-07-25 12:38

what is other programs (notepad, cmd.exe) behaviour ?

theultramage

2012-07-25 14:28

reporter   bugnote:0009441

Only FAR seems to be having this problem. Also note what I said at the beginning - when I run the older r6425 build, it works just fine. I'll try to find the true cause for you within the next 2 weeks.

2useven10

2012-07-25 14:36

developer   bugnote:0009442

you can use nightly build archive to estimate first problem build.
http://www.farmanager.com/nightly.php

2useven10

2012-08-09 08:46

developer   bugnote:0009466

two weeks later...

theultramage

2012-08-09 16:59

reporter   bugnote:0009469

Heh, work+vacation, didn't have my vs2010 build environment to do the tests, and the builds inside the link you posted only go to december 2011 (which is several months too late).

r6496 | skirda | 2011-08-01 13:47:15 +0200
Mantis#0001832 - http://bugs.farmanager.com/view.php?id=1832

theultramage

2012-08-09 17:08

reporter   bugnote:0009470

Last edited: 2012-08-09 17:35

The offending change is:
+ case VK_OEM_MINUS:
+ return '_';
+ //return KEY_SHIFT|'-';
+ case VK_OEM_PLUS:
+ return '+';
+ //return KEY_SHIFT|'+';

The code was later changed to, which is apparently trying to do something...
            case VK_OEM_MINUS:
                return (Char>=' ')?Char:'_';
            case VK_OEM_PLUS:
                return (Char>=' ')?Char:'+';

My current fix is:
            case VK_OEM_MINUS:
                return (Char>=' ')?Char:KEY_SHIFT|'-';
            case VK_OEM_PLUS:
                return (Char>=' ')?Char:KEY_SHIFT|'=';
(although I don't really know what I'm doing)

2useven10

2012-08-10 11:15

developer   bugnote:0009471

Unfortunately I can't check that.
Always have č only...

2useven10

2012-08-15 09:43

developer   bugnote:0009481

similar problem (russian forum)
http://forum.farmanager.com/viewtopic.php?f=9&t=7346

theultramage

2012-08-15 20:16

reporter   bugnote:0009482

Last edited: 2012-08-15 20:26

Umm, this is going to sound really stupid, but here's what I found while testing...
1) install sk win7 into virtualbox VM
2) install en LIP and switch interface to en
3) confirm that the bug is present
4) switch back to sk, then switch again to en
5) confirm that the bug is gone

I'm not kidding, I re-ran steps 3-5 several times using an immutable disk image, and it's always the same - switching to sk fixes it, and it stays fixed when switching back to en. I don't understand. If needed I can re-test it from step 1.
EDIT: confirmed on the laptop I originally reported this from.

2useven10

2012-08-15 21:52

developer   bugnote:0009483

Last edited: 2012-08-16 02:16

It is funny micracle soft. But anyway I think it should be fixed in farmanager.
There is almost the same problem with sweden W8. Please keep bugly system environment to test possible fix[es].
(I hope from originators of 0001832).

Maximus

2012-08-16 19:43

reporter   bugnote:0009487

Please, provide output of KeyEvents utility
http://code.google.com/p/conemu-maximus5/downloads/detail?name=KeyEvents4.7z

You need to start it from Far, type sequence 'shift' '=' '<letter>' and attach output here.

This issue does not reproduced on my PC, too.

theultramage

2012-08-16 22:47

reporter   bugnote:0009491

Last edited: 2012-08-16 22:53

That is a pretty awesome tool!
Here's the recording. It's the same for both the bugged and fixed VM state.

Dn, Vk="VK_SHIFT"    [ 16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x10
Dn, Vk="VK_OEM_PLUS" [187/0x00BB], Scan=0x000D uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x10
Up, Vk="VK_OEM_PLUS" [187/0x00BB], Scan=0x0000 uChar=[U=''  (0x02C7): A='ă' (0xC7)] Ctrl=0x10
Up, Vk="VK_OEM_PLUS" [187/0x00BB], Scan=0x000D uChar=[U=''  (0x02C7): A='ă' (0xC7)] Ctrl=0x10
Up, Vk="VK_SHIFT"    [ 16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00
Dn, Vk="VK_C"        [ 67/0x0043], Scan=0x002E uChar=[U=''  (0x010D): A=' ' (0x0D)] Ctrl=0x00
Up, Vk="VK_C"        [ 67/0x0043], Scan=0x002E uChar=[U='c' (0x0063): A='c' (0x63)] Ctrl=0x00

Maximus

2012-08-17 22:53

reporter  

Diacritic1.diff (3,992 bytes)   
Index: keyboard.cpp
===================================================================
--- keyboard.cpp	(revision 8321)
+++ keyboard.cpp	(working copy)
@@ -895,6 +895,8 @@
 
 	if (rec->EventType==KEY_EVENT)
 	{
+		static bool bForceAltGr = false;
+
 		if (!rec->Event.KeyEvent.bKeyDown)
 		{
 			was_repeat = false;
@@ -904,8 +906,21 @@
 		{
 			was_repeat = (last_pressed_keycode == rec->Event.KeyEvent.wVirtualKeyCode);
 			last_pressed_keycode = rec->Event.KeyEvent.wVirtualKeyCode;
+
+			if (rec->Event.KeyEvent.wVirtualKeyCode == VK_MENU)
+			{
+				// ��������� � AltGr (��������� ����������)
+				bForceAltGr = (rec->Event.KeyEvent.wVirtualScanCode == 0)
+					&& ((rec->Event.KeyEvent.dwControlKeyState & 0x1F) == 0x0A);
+			}
 		}
 
+		if (bForceAltGr && (rec->Event.KeyEvent.dwControlKeyState & 0x1F) == 0x0A)
+		{
+			rec->Event.KeyEvent.dwControlKeyState &= ~LEFT_ALT_PRESSED;
+			rec->Event.KeyEvent.dwControlKeyState |= RIGHT_ALT_PRESSED;
+		}
+
 		DWORD CtrlState=rec->Event.KeyEvent.dwControlKeyState;
 
 		//_SVS(if(rec->EventType==KEY_EVENT)SysLog(L"[%d] if(rec->EventType==KEY_EVENT) >>> %s",__LINE__,_INPUT_RECORD_Dump(rec)));
@@ -2388,6 +2403,19 @@
 	{
 		if (Char>=' ')
 			return Char;
+		else if (RealKey && ScanCode && !Char && (KeyCode && KeyCode != VK_MENU))
+			//��� ��������� �� ����� ������ ���� � �������, �������� � �����.
+			//������� �� �������� ���������, "AltGr+VK_OEM_1" ����� �� ������ ����������� �����, �.�. ��� DeadKey
+			//Dn, 1, Vk="VK_CONTROL" [17/0x0011], Scan=0x001D uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00000008 (Casac - ecns)
+			//Dn, 1, Vk="VK_MENU" [18/0x0012], Scan=0x0038 uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00000109 (CasAc - Ecns)
+			//Dn, 1, Vk="VK_OEM_1" [186/0x00BA], Scan=0x001B uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00000009 (CasAc - ecns)
+			//Up, 1, Vk="VK_CONTROL" [17/0x0011], Scan=0x001D uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00000001 (casAc - ecns)
+			//Up, 1, Vk="VK_MENU" [18/0x0012], Scan=0x0038 uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00000100 (casac - Ecns)
+			//Up, 1, Vk="VK_OEM_1" [186/0x00BA], Scan=0x0000 uChar=[U='~' (0x007E): A='~' (0x7E)] Ctrl=0x00000000 (casac - ecns)
+			//Up, 1, Vk="VK_OEM_1" [186/0x00BA], Scan=0x001B uChar=[U='�' (0x00A8): A='' (0xA8)] Ctrl=0x00000000 (casac - ecns)
+			//Dn, 1, Vk="VK_A" [65/0x0041], Scan=0x001E uChar=[U='�' (0x00E3): A='' (0xE3)] Ctrl=0x00000000 (casac - ecns)
+			//Up, 1, Vk="VK_A" [65/0x0041], Scan=0x001E uChar=[U='a' (0x0061): A='a' (0x61)] Ctrl=0x00000000 (casac - ecns)
+			return KEY_NONE;
 		else
 			IntKeyState.CtrlPressed=0;
 	}
@@ -3216,6 +3244,22 @@
 			return ModifAlt|KeyCode;
 	}
 
+	if (!IntKeyState.CtrlPressed && !IntKeyState.AltPressed && (KeyCode >= VK_OEM_1 && KeyCode <= VK_OEM_8) && !Char)
+	{
+		//��� ��������� �� ����, ���� ��� �� ���������� �� DeadKeys (����� �� ����� � Shift-��)
+		//������ ��������� �� ����� �������� � ����������� (����, �����, � ��.)
+		//Dn, Vk="VK_SHIFT"    [ 16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x10
+		//Dn, Vk="VK_OEM_PLUS" [187/0x00BB], Scan=0x000D uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x10
+		//Up, Vk="VK_OEM_PLUS" [187/0x00BB], Scan=0x0000 uChar=[U=''  (0x02C7): A='?' (0xC7)] Ctrl=0x10
+		//Up, Vk="VK_OEM_PLUS" [187/0x00BB], Scan=0x000D uChar=[U=''  (0x02C7): A='?' (0xC7)] Ctrl=0x10
+		//Up, Vk="VK_SHIFT"    [ 16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)] Ctrl=0x00
+		//Dn, Vk="VK_C"        [ 67/0x0043], Scan=0x002E uChar=[U=''  (0x010D): A=' ' (0x0D)] Ctrl=0x00
+		//Up, Vk="VK_C"        [ 67/0x0043], Scan=0x002E uChar=[U='c' (0x0063): A='c' (0x63)] Ctrl=0x00
+		UINT uCalcChar=MapVirtualKey(KeyCode,MAPVK_VK_TO_CHAR);
+		if (!uCalcChar)
+			return KEY_NONE;
+	}
+
 	if (IntKeyState.ShiftPressed)
 	{
 		_SVS(if (KeyCode!=VK_SHIFT) SysLog(L"Shift -> |%s|%s|",_VK_KEY_ToName(KeyCode),_INPUT_RECORD_Dump(rec)));
Diacritic1.diff (3,992 bytes)   

Maximus

2012-08-17 22:54

reporter   bugnote:0009492

Patch implement sort of shamanism for dead keys. Hope, it's working.

2useven10

2012-09-05 12:20

developer   bugnote:0009502

2794 (from Maximus)

theultramage

2012-09-05 13:31

reporter   bugnote:0009503

Made a clean far build, still happens there.
Currently using the patch I mentioned in my 4th post to work around the issue.

2useven10

2012-09-13 18:26

developer   bugnote:0009516

once more (I can't reproduce again)...
http://forum.farmanager.com/viewtopic.php?f=37&t=7387

2useven10

2012-09-18 18:17

developer   bugnote:0009523

2 Maximus.
Bug reproduced on my win7.
English and Russian languages installed. Active language is English.
Czech Qwerty keyboard layout added.

2useven10

2012-09-19 06:30

developer   bugnote:0009524

Last edited: 2012-09-19 06:36

2 Maximus
MapVirtualKey() doesn't detect deadkey, so patch is useless here.
What is wrong with theultramage fix ? It seems to work.
And why KEY_SHIFT | ... combinations were replaced originally ?

Maximus

2012-09-19 07:32

reporter   bugnote:0009525

Well, I'll try to explain, what confuses me.

This patch

            case VK_OEM_MINUS:
                 return (Char>=' ')?Char:KEY_SHIFT|'-';
             case VK_OEM_PLUS:
                 return (Char>=' ')?Char:KEY_SHIFT|'=';

takes into account only two keys. Much more keys may produce dead keys...
And, I think, it must be

                 return (Char>=' ')?KEY_NONE:...

My patch - was a try to unify all keys, not just "+"/"-". We may try to replace

        UINT uCalcChar=MapVirtualKey(KeyCode,MAPVK_VK_TO_CHAR);
        if (!uCalcChar)
            return KEY_NONE;

with just
                return KEY_NONE;

May be, it will works?

theultramage

2012-09-19 09:00

reporter   bugnote:0009526

Last edited: 2012-09-19 14:01

> And why KEY_SHIFT | ... combinations were replaced originally ?
Just a cosmetic thing I believe, KEY_SHIFT|'-' == '_' and KEY_SHIFT|'=' == '+'. The author of the original r6496 edit used the compact version and left the expanded version as commented out lines (which was really confusing), and he made a typo in the commented line (more confusion). I thought it would be more readable if I used the expanded form since it shows the keys you actually have to press... but looking at it now, since the cases are VK_OEM_PLUS and VK_OEM_MINUS, maybe using + and - would make more sense.
EDIT: never mind, I was wrong, KEY_SHIFT is not an ascii flag, it's a FAR-specific define with value 0x04000000 and special meaning.

2useven10

2012-09-19 09:43

developer   bugnote:0009527

2809. both fixes here. maximus code works.

theultramage

2012-09-19 14:10

reporter   bugnote:0009528

Confirmed working on my win7 system + in vbox VM that also had the problem.
Thank you for finding the time to reproduce and fix it.

Issue History

Date Modified Username Field Change
2012-07-18 15:59 theultramage New Issue
2012-07-24 10:08 2useven10 Note Added: 0009428
2012-07-24 10:10 2useven10 Note Edited: 0009428
2012-07-25 12:14 theultramage Note Added: 0009437
2012-07-25 12:36 2useven10 Note Added: 0009438
2012-07-25 12:38 2useven10 Note Edited: 0009438
2012-07-25 14:28 theultramage Note Added: 0009441
2012-07-25 14:36 2useven10 Note Added: 0009442
2012-08-09 08:46 2useven10 Note Added: 0009466
2012-08-09 16:59 theultramage Note Added: 0009469
2012-08-09 17:08 theultramage Note Added: 0009470
2012-08-09 17:10 theultramage Note Edited: 0009470
2012-08-09 17:10 theultramage Note Edited: 0009470
2012-08-09 17:27 theultramage Note Edited: 0009470
2012-08-09 17:32 theultramage Note Edited: 0009470
2012-08-09 17:35 theultramage Note Edited: 0009470
2012-08-10 11:15 2useven10 Note Added: 0009471
2012-08-15 09:41 2useven10 Relationship added related to 0001832
2012-08-15 09:43 2useven10 Note Added: 0009481
2012-08-15 20:16 theultramage Note Added: 0009482
2012-08-15 20:26 theultramage Note Edited: 0009482
2012-08-15 21:52 2useven10 Note Added: 0009483
2012-08-16 02:16 2useven10 Note Edited: 0009483
2012-08-16 19:43 Maximus Note Added: 0009487
2012-08-16 22:47 theultramage Note Added: 0009491
2012-08-16 22:49 theultramage Note Edited: 0009491
2012-08-16 22:50 theultramage Note Edited: 0009491
2012-08-16 22:51 theultramage Note Edited: 0009491
2012-08-16 22:52 theultramage Note Edited: 0009491
2012-08-16 22:53 theultramage Note Edited: 0009491
2012-08-17 22:53 Maximus File Added: Diacritic1.diff
2012-08-17 22:54 Maximus Note Added: 0009492
2012-09-05 12:20 2useven10 Note Added: 0009502
2012-09-05 12:20 2useven10 Assigned To => 2useven10
2012-09-05 12:20 2useven10 Status new => feedback
2012-09-05 13:31 theultramage Note Added: 0009503
2012-09-05 13:31 theultramage Status feedback => assigned
2012-09-13 18:26 2useven10 Note Added: 0009516
2012-09-18 18:17 2useven10 Note Added: 0009523
2012-09-19 06:30 2useven10 Note Added: 0009524
2012-09-19 06:36 2useven10 Note Edited: 0009524
2012-09-19 07:32 Maximus Note Added: 0009525
2012-09-19 09:00 theultramage Note Added: 0009526
2012-09-19 09:00 theultramage Note Edited: 0009526
2012-09-19 09:43 2useven10 Note Added: 0009527
2012-09-19 09:43 2useven10 Status assigned => feedback
2012-09-19 14:01 theultramage Note Edited: 0009526
2012-09-19 14:10 theultramage Note Added: 0009528
2012-09-19 14:10 theultramage Status feedback => assigned
2012-09-20 08:40 2useven10 Build => 2809
2012-09-20 08:40 2useven10 Status assigned => closed
2012-09-20 08:40 2useven10 Resolution open => fixed
2012-09-20 08:40 2useven10 Fixed in Version => 3.0