New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange ReadConsoleInputW behavior on Windows10 #927

Open
lv-gh opened this Issue Oct 25, 2016 · 10 comments

Comments

Projects
None yet
2 participants
@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Oct 25, 2016

Owner

TLDR.
ConEmu do not do asterisk expansion on paste.
Third-party application problems

Owner

Maximus5 commented Oct 25, 2016

TLDR.
ConEmu do not do asterisk expansion on paste.
Third-party application problems

@lv-gh

This comment has been minimized.

Show comment
Hide comment
@lv-gh

lv-gh Oct 25, 2016

I do understand, but i hoped, that you can elaborate on that as this bug might be a problem for a conemu itself. Why when KeyEvents behavior is different on conemu and cmd? Please read the last comment from that issue report.

lv-gh commented Oct 25, 2016

I do understand, but i hoped, that you can elaborate on that as this bug might be a problem for a conemu itself. Why when KeyEvents behavior is different on conemu and cmd? Please read the last comment from that issue report.

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Oct 25, 2016

Owner

Last comment doesn't show the difference: KeyEvents outside of ConEmu.

FYI: RAlt+RCtrl combination means AltGr.

Owner

Maximus5 commented Oct 25, 2016

Last comment doesn't show the difference: KeyEvents outside of ConEmu.

FYI: RAlt+RCtrl combination means AltGr.

@lv-gh

This comment has been minimized.

Show comment
Hide comment
@lv-gh

lv-gh Oct 25, 2016

Yes, it shows only strange behavior. The difference is that Ctrl flag gets value of 0x0019 in cmd, and 0x001A in conemu. That mean pretty different things: LEFT_CTRL + LEFT_ALT pressed in conemu and LEFT_CTRL + RIGHT_ALT in cmd. Here it is:

conemu: (Lithuanian keyboard, Shift+INS, clipboard contains '.*')

14:50:56 KEY_EVENT_RECORD: Dn, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000030 (caSac - ecNs) (Windowed)
14:50:56 KEY_EVENT_RECORD: Dn, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Up, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Dn, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x0000001A (CASac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Up, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x0000001A (CASac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Up, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000020 (casac - ecNs) (Windowed)

cmd:

14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000030 (caSac - ecNs) (Windowed)
14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_MENU" [18/0x0012], Scan=0x0038 uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000109 (CasAc - Ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x00000019 (CaSAc - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x00000019 (CaSAc - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_MENU" [18/0x0012], Scan=0x0038 uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000100 (casac - Ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000020 (casac - ecNs) (Windowed)

lv-gh commented Oct 25, 2016

Yes, it shows only strange behavior. The difference is that Ctrl flag gets value of 0x0019 in cmd, and 0x001A in conemu. That mean pretty different things: LEFT_CTRL + LEFT_ALT pressed in conemu and LEFT_CTRL + RIGHT_ALT in cmd. Here it is:

conemu: (Lithuanian keyboard, Shift+INS, clipboard contains '.*')

14:50:56 KEY_EVENT_RECORD: Dn, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000030 (caSac - ecNs) (Windowed)
14:50:56 KEY_EVENT_RECORD: Dn, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Up, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Dn, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x0000001A (CASac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Up, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x0000001A (CASac - ecns) (Windowed)
14:50:56 KEY_EVENT_RECORD: Up, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000020 (casac - ecNs) (Windowed)

cmd:

14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000030 (caSac - ecNs) (Windowed)
14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_OEM_PERIOD" [190/0x00BE], Scan=0x0034 uChar=[U='.' (0x002E): A='.' (0x2E)]
         Ctrl=0x00000000 (casac - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_MENU" [18/0x0012], Scan=0x0038 uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000109 (CasAc - Ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Dn, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x00000019 (CaSAc - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_8" [56/0x0038], Scan=0x0009 uChar=[U='*' (0x002A): A='*' (0x2A)]
         Ctrl=0x00000019 (CaSAc - ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_MENU" [18/0x0012], Scan=0x0038 uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000100 (casac - Ecns) (Windowed)
14:52:48 KEY_EVENT_RECORD: Up, 1, Vk="VK_SHIFT" [16/0x0010], Scan=0x002A uChar=[U=' ' (0x0000): A=' ' (0x00)]
         Ctrl=0x00000020 (casac - ecNs) (Windowed)
@lv-gh

This comment has been minimized.

Show comment
Hide comment
@lv-gh

lv-gh Oct 25, 2016

Have to add, that in any case (conemu or cmd) Ctrl (dwControlKeyState) flag value is invalid, because actually no Ctrl or Alt key is pressed.
ReadConsoleInputW() works the same and correctly with other keyboards: Ctrl gets value of 0x0010 (SHIFT_PRESSED)

lv-gh commented Oct 25, 2016

Have to add, that in any case (conemu or cmd) Ctrl (dwControlKeyState) flag value is invalid, because actually no Ctrl or Alt key is pressed.
ReadConsoleInputW() works the same and correctly with other keyboards: Ctrl gets value of 0x0010 (SHIFT_PRESSED)

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Oct 25, 2016

Owner

FYI: RAlt+RCtrl combination means AltGr.

This is weird but "valid" combination

Owner

Maximus5 commented Oct 25, 2016

FYI: RAlt+RCtrl combination means AltGr.

This is weird but "valid" combination

@lv-gh

This comment has been minimized.

Show comment
Hide comment
@lv-gh

lv-gh Oct 25, 2016

But why conemu changes dwControlKeyState? Or how can you explain dwControlKeyState difference in cmd and conemu?

lv-gh commented Oct 25, 2016

But why conemu changes dwControlKeyState? Or how can you explain dwControlKeyState difference in cmd and conemu?

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Oct 25, 2016

Owner

Consider this as a bug or limitation of ConEmu.
Chars are converted to VK+dwControlKeyState using WinAPI, ConEmu doesn't invent them.
I can't say more without investigations.

Owner

Maximus5 commented Oct 25, 2016

Consider this as a bug or limitation of ConEmu.
Chars are converted to VK+dwControlKeyState using WinAPI, ConEmu doesn't invent them.
I can't say more without investigations.

@lv-gh

This comment has been minimized.

Show comment
Hide comment
@lv-gh

lv-gh Oct 25, 2016

Ok, thanks. Would you be interested in further debugging results (other keyboards, etc)?

lv-gh commented Oct 25, 2016

Ok, thanks. Would you be interested in further debugging results (other keyboards, etc)?

@Maximus5

This comment has been minimized.

Show comment
Hide comment
@Maximus5

Maximus5 Oct 25, 2016

Owner

Not yet, may be later. Thanks.

Owner

Maximus5 commented Oct 25, 2016

Not yet, may be later. Thanks.

Maximus5 added a commit that referenced this issue Nov 28, 2016

gh-927: Appropriate behavior while posting chars with AltGr pressed.
  Example: print("*") when Lithuanian keyboard layout is selected.

Maximus5 added a commit that referenced this issue Dec 3, 2016

gh-927: Appropriate behavior while posting chars with AltGr pressed.
  Example: print("*") when Lithuanian keyboard layout is selected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment