Getch() Problem: C vs D

LouisHK via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 9 18:37:31 PST 2017


On Tuesday, 10 January 2017 at 02:04:07 UTC, Adam D. Ruppe wrote:
> On Tuesday, 10 January 2017 at 01:06:53 UTC, LouisHK wrote:
>> So, I thought a little bit and I changed the terminal.d to 
>> check on the KeyEvent if the KeyEvent.bKeyDown is true, 
>> otherwise assigns a null event, and it's working fine and now 
>> I can get the ESCAPE key. :)
>
> What line did you change? ...

So, I was seeing and my version is a bit older than the one in 
the GitHub, but I looked over it, and I think you should put the 
code below at the line 1797[1]:

     if(!buffer[0].KeyEvent.bKeyDown){ return null ;}


So, it will stay inside the case KEY_EVENT: and will check the if 
KEY status is DOWN, otherwise will return null event.

Again this worked for me, but my terminal.d version is a bit 
older, and you may had already fixed, I can't change the version 
right now to test because I have some legacy code. But I'll try 
in another computer with the last version.

[1]: 
(https://github.com/adamdruppe/arsd/blob/master/terminal.d#L1797).

L.


More information about the Digitalmars-d-learn mailing list