The DECRQCRA
escape sequence allows you to query the checksum of a rectangular area.
The checksum is basically the sum of the character codes there. And if you choose a 1×1 rectangular area then... bamm, there's the character code.
This feature is used e.g. by the test suite esctest
.
By far not every terminal supports it. Some don't implement it because of laziness (practically no one needs this feature). Some deliberately don't implement it because of privacy / security concerns (if you ssh
/telnet
/netcat
to a remote machine which has been compromised, then it can look at your screen and see earlier contents). Some make it subject to some sort of developer flag, in order to be able to run esctest
, but not to open up that privacy / security hole by default.
man bash
and Z-shell's line editor inman zshzle
. I'm unaware of any thing that would interact with arbitrary positions in the terminal emulator window.