More precisely, this is not a feature of the terminals but of readline.
https://www.man7.org/linux/man-pages/man3/readline.3.html
All engineers working with the command line (even after 35 years) really, really should open and read
man bash
and man readline