CosmosOS / Cosmos

Cosmos is an operating system "construction kit". Build your own OS using managed languages such as C#, VB.NET, and more!
https://www.goCosmos.org
BSD 3-Clause "New" or "Revised" License
2.94k stars 552 forks source link

KeyboardManager Assign wrong char when doing a 'Tab' it assing an '\0' instead of '\t' #2894

Closed Guillermo-Santos closed 10 months ago

Guillermo-Santos commented 10 months ago

Area of Cosmos - What area of Cosmos are we dealing with?

Cosmos.System and Cosmos.HAL i guess.

Expected Behaviour - What do you think that should happen?

To write a tab on the console.

Actual Behaviour - What unexpectedly happens?

It writes a null character.

Reproduction - How did you get this error to appear?

image

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

9xbt commented 10 months ago

I'm confused, so ReadKey() returns null when doing a tab?

Guillermo-Santos commented 10 months ago

No, it return '\0', the null char. That happends with tab and some others

zarlo commented 10 months ago

we might not have the key map?

zarlo commented 10 months ago

mmm it looks to be mapped https://github.com/CosmosOS/Cosmos/blob/master/source/Cosmos.System2/Keyboard/ScanMaps/USStandardLayout.cs#L41 but i have no clue dont know much about this part of cosmos

zarlo commented 10 months ago

okay we might need to do what is done for space and add '\t' as the second argument

Guillermo-Santos commented 10 months ago

i will se if that is

Guillermo-Santos commented 10 months ago

okay we might need to do what is done for space and add '\t' as the second argument

it is and is not at the same time?

image

the space i marked on red was a tab done with console.readkey, an the dots market on blue are four tabs i did on readline...i'll have to check my console plugs again...xd

zarlo commented 10 months ago

i think we had it so /t was hard coded as 4 spaces when printing in Console

Guillermo-Santos commented 10 months ago

i changed it to be a dynamic size depending on X cursor position.

The thing on that image is that when i made the change you pointed out readkey started to work correctly, but for some reason readline is getting the wrong char, or is making the wrong conversion.

Guillermo-Santos commented 10 months ago

the only difference i see is that ReadKey use Console.WriteLine to write the character, while ReadLine write directly to the textscreen (this because readline actually write to console even when output is redirected).

Guillermo-Santos commented 10 months ago

This was the second issue....well...i'll make a PR then

image