jline / jline3

JLine is a Java library for handling console input.
Other
1.46k stars 214 forks source link

IndexOutOfBoundsException in console-ui when header exceeds size of the terminal, fixes #1025 #1026

Closed mattirn closed 1 month ago

gnodet commented 2 months ago

Can we reuse the provided example to create a unit test for that ?

mattirn commented 2 months ago

Can we reuse the provided example to create a unit test for that ?

Yes, that can be done.... though I'm not able to create InputStream with enter-key chars. I have tried to create it as

        InputStream inputStream = new ByteArrayInputStream("\r\r\r\r\r".getBytes());

but it does not work correctly. Currently I'm working on Windows if that does matter.

gnodet commented 2 months ago

Can we reuse the provided example to create a unit test for that ?

Yes, that can be done.... though I'm not able to create InputStream with enter-key chars. I have tried to create it as

        InputStream inputStream = new ByteArrayInputStream("\r\r\r\r\r".getBytes());

but it does not work correctly. Currently I'm working on Windows if that does matter.

That's because the InputFlag.ICRNL is set by default in the LineDisciplinedTerminal, which makes me think that the console ui KeyMap should support both \r and \n to validate input.