Is there a way to prevent canonical mode from echoing characters such as arrow keys by modifying the termios struct?
I've tried to play around with raw mode but I would need to rewrite a lot in order to make this bit of functionality work, that is already available in canonical mode
Is there a way to prevent canonical mode from echoing characters such as arrow keys by modifying the termios struct?
The termios interfaces provide a comparatively large number of flags for modulating echo behavior. All have effect in canonical mode, and most of them only in that mode. But none of them provide for suppressing echo of arbitrary characters. They are all either general to all characters or specific to particular characters. So no.
I've tried to play around with raw mode but I would need to rewrite a lot in order to make this bit of functionality work, that is already available in canonical mode
No doubt you would. Raw mode is not intended for interactive terminals. At least, not for direct exposure to interactive users.
If the terminal driver does not by itself meet all your needs, and you do not want to write your own command-line editing code, then you should consider using a third-party library that does the job. GNU readline (libreadline; GPL-licensed) or BSD-derived EditLine (libedit; BSD-licensed) would be candidates to consider.