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

Key-Up event not posted for 'space' and 'return' keys #1925

Closed
Maximus5 opened this Issue Jul 31, 2015 · 8 comments

Comments

Projects
None yet
1 participant
@Maximus5
Owner

Maximus5 commented Jul 31, 2015

Originally reported on Google Code with ID 1927

OS version: Win7 x64
ConEmu version: 150303 preview
Far version (if you are using Far Manager): N/A

Bug description:
----------------

My console application reads console input using the ReadConsoleInput() function defined
in the Win32-API.

When starting the application from ConEmu, I don't get they key-up event for the SPACE
and RETURN keys. This results in the key being treated as "sticky" by the application,
or not responding to the key if the application checks for the key-up status.

I have disabled all keyboard hooking options in ConEmu's settings, but the problem
remains.

Reproducing:
------------

You should be able to reproduce with any application that reads console input events
via the ReadConsoleInput() function.

I have attached a script file that simply displays incoming events. Just drag the script
'contest.jc' onto the runtime 'jilrun.exe'.

Reported by s.kuhn2010 on 2015-03-05 02:41:07


- _Attachment: [contest.zip](https://storage.googleapis.com/google-code-attachments/conemu-maximus5/issue-1927/comment-0/contest.zip)_
@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

ConEmu installer has KeyEvents tool. It can be downloaded separately from here:
http://conemu-maximus5.googlecode.com/files/KeyEvents4.7z
This tool shows that both Down and Up events are passed to the application input queue.

Reported by ConEmu.Maximus5 on 2015-03-05 13:51:11

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

I've checked jilrun. The problem comes from the fact jilrun uses ReadConsoleInputA instead
of unicode variant.

Reported by ConEmu.Maximus5 on 2015-03-05 14:35:58

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

Thanks for the info. I'll look into using the ReadConsoleInputW function.

However, are you saying it's a bug of the ReadConsoleInputA function?

Then why does it work correctly with the normal windows console?

And does it mean ConEmu doesn't support non-unicode applications?

Reported by s.kuhn2010 on 2015-03-05 16:41:53

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

I will commit fix later this night. Non-unicode are supported of course. But ConEmu
is using obviously different brunches of code to handle them.

Anyway, switching jilrun to W-function will not (most probably) fix that problem.

Reported by ConEmu.Maximus5 on 2015-03-05 16:50:05

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

I switched to W-function, but you were right, it didn't change anything.

I then checked source of your KeyEvents demo. I found nothing that was really different
between how I read events and how you do it.

I commented out SetConsoleMode() but it didn't change anything.

Really weird problem. Thanks for looking into it.

Reported by s.kuhn2010 on 2015-03-05 17:27:21

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

You are not waiting for event. You are reading it when it's already in the buffer. That's
the difference.

Reported by ConEmu.Maximus5 on 2015-03-05 17:31:45

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

OK, I have changed the script so that it always asks for an input event, even if none
is in the buffer. This will make ReadConsoleInput block and wait, just like your CPP
does.

It gives me the same results. No Key-Up for space and return.

Reported by s.kuhn2010 on 2015-03-05 22:10:28

@Maximus5

This comment has been minimized.

Owner

Maximus5 commented Jul 31, 2015

150305

Reported by ConEmu.Maximus5 on 2015-03-05 22:24:38

  • Status changed: Fixed

@Maximus5 Maximus5 closed this Jul 31, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment