NordicPlayground / pc-xterm-lib

Other
2 stars 0 forks source link

Introduce terminal mode for character vs line behaviour #20

Closed michaeljones closed 3 years ago

michaeljones commented 3 years ago

For the nrf terminal, we want to be able to toggle easily between 'character' input and 'line' input without losing the current xterm session. That means we need to allow the NrfTerminalCommander to toggle between those modes.

Here we introduce such a mode with the idea that 'line' mode (the default) continues to behave as normal but the 'character' mode option allows the client code to provide 'onData' and 'onKey' hooks that'll be used instead of the default ones and allow for a direct character mode.

We use a 'setter' to follow suit with the rest of the class but I'd be happy to change it to a setTerminalMode method as it is doing a bit of work.

We don't disable any of the other plugins that the commander adds. From testing, they don't seem to impact character mode.