mabe02 / lanterna

Java library for creating text-based GUIs
GNU Lesser General Public License v3.0
2.23k stars 243 forks source link

ALT modifier not evaluated on TERM=linux #551

Closed francescomuia closed 2 years ago

francescomuia commented 2 years ago

In the unemulated terminal, TERM=linux, the modifier ALT or SHIFT is not recognized. This prevent to use scrolling. I entered a few lines of logging and got the following output.

Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: currentMatching [^[] Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: matching Matching{partialMatch=true, fullMatch=KeyStroke{keytype=Escape}} Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: currentMatching [^[, [] Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: matching Matching{partialMatch=true, fullMatch=KeyStroke{keytype=Character, character='[', modifiers=[alt]}} Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: currentMatching [^[, [, B] Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: matching Matching{partialMatch=false, fullMatch=KeyStroke{keytype=ArrowDown}} Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: AFTER WHILE KeyStroke{keytype=ArrowDown}

avl42 commented 2 years ago

Well, unfortunately the linux konsole just doesn't reveal this information about modifiers.

E.g., whatever modifiers you press with the ArrowDown key, you only get an Esc [ B sequence.

The only solution here would be to provide a patch for the linux kernel to send different sequences for modified keys in the konsole mode.

Btw., much of lanterna's input-decoding was contributed by me. I kind of know what I'm talking about ;-)

On Tue, Oct 5, 2021 at 8:45 AM francescomuia @.***> wrote:

In the unemulated terminal, TERM=linux, the modifier ALT or SHIFT is not recognized. This prevent to use scrolling. I entered a few lines of logging and got the following output.

Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: currentMatching [^[] Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: matching Matching{partialMatch=true, fullMatch=KeyStroke{keytype=Escape}} Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: currentMatching [^[, [] Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: matching Matching{partialMatch=true, fullMatch=KeyStroke{keytype=Character, character='[', modifiers=[alt]}} Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: currentMatching [^[, [, B] Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: matching Matching{partialMatch=false, fullMatch=KeyStroke{keytype=ArrowDown}} Oct 05, 2021 8:58:21 AM com.googlecode.lanterna.input.InputDecoder getNextCharacter INFO: AFTER WHILE KeyStroke{keytype=ArrowDown}

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mabe02/lanterna/issues/551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIDBMVOCJ5ETL453JSZN7LUFKNHNANCNFSM5FLAGD7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mabe02 commented 2 years ago

Yeah, pretty much what @avl42 says :)