-
-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple character translation is needed #66
Comments
I think the first remapping is reasonable because it is required for tio to work with Arduino devices. However, the CTRL-H remapping seems a bit arbitrary to me. I've never seen any terminal application support this and I'm not sure I want to start support all sort of remappings, except the necessary ones. Buspirate fix your backspace 😄 |
That is not only a Buspirate problem. Backspace vs DEL is actually a way more common issue when dealing with terminal emulators than the \n vs \r\n problem. See e.g. here: Most terminal emulators allow to remap this, because messing with stty and what not will usually break other programs (or requires wrapper scripts). E.g. Putty allows to remap this, Screen allows to do it, Minicom, etc. Pretty much every single terminal program, because it is so common problem. Furthermore, it is a fairly trivial fix, all that is needed is a command line option and then a lookup table to use when sending/receiving the characters. That would easily allow support for both the newline remap and this (and any other remap that may be needed in the future - e.g. whether RETURN should send only LF or CR+LF is sometimes required). |
Hmm. you are of course right. I've just never noticed it myself because I work mostly with Linux targets where this is normally not an issue. Yes, it is a trivial fix. However, I think I have to consider creating a programmable mapping interface to solve any future remapping needs in one go instead of adding new flags. The current mapping flags are those directly supported and remapped by the tty device itself. Anything else would have to be remapped by tio. |
One solution that I have seen for handling the user interface part of this was for the user to provide a mapping table (= two strings). Kinda like the 'tr' Unix command. However, for these very common cases I think also a dedicated option would be good, because having to specify the table only because my Backspace key isn't working right is a pain. Most terminal programs don't attempt to be very smart here - just offer e.g. a checkbox to swap Backspace/DEL or interpret LF as CR+LF, nothing more. BTW, Backspace/DEL can be remapped by the tty device itself (there is an stty command for it). There may be one for the CR+LF issue too but I am not too sure about that. |
I want to keep the tio interface simple so all mappings are specified via the --map option. For now, what we could do is add support for the following flags: INLCRNL: Map NL -> CR-NL on input. |
OK, that works for me. |
I've added a branch that features the new mappings here: Please feel free to test. If it works for you I'll add it to mainline. In the future I might rework the mapping code to make it fully programmable but this will have to do for now. |
OK, testing the code and there are some buglets:
|
He he ok, fixed. I've put a note to see the man page for mapping flag details - I think that should suffice. |
OK, thanks! |
Great, I'll merge it in. Thanks for testing! 👍 |
It would be really helpful to have an option to translate received '\n' to '\r\n' for devices that don't send the '\r' character (e.g. many Arduino-based ones).
Another useful option would be to allow the backspace character to be remapped to actual CTRL+H - e.g. my Buspirate doesn't react to backspace and I have to use CTRL+H to erase character in the built-in shell.
The text was updated successfully, but these errors were encountered: