Question

Is it possible to capture page up and page down keys using Lanterna? I'm creating a (specialized) hex editor in Java and thought that it would be a good idea to integrate terminal / curses support as well. If it isn't possible, is it possible in one of the other libraries that use native code (such as the Java curses library)?

Or should I go the way of more and less and use specific keys (space and b for back)?

Was it helpful?

Solution

It seems that Key.Kind in Lanterna 2 and KeyType in Lanterna 3 can be used to find these keys. So you should not look for specific characters.

All the function keys, and all the control keys, even including the enter key can be easily found this way. Only the normal letters and other characters are indicated by NormalKey in Lanterna 2 and Character in Lanterna 3.

For Lanterna 2, this information can be found here under caption Read keyboard input.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top