Thought this snippet from Debian's ncurses FAQ (I'm actually reading
this in a patch, so I don't know where this file lives in Debian):
Home/End keys don't work in some non-full-screen applications.
The situation with this is somewhat complicated. For a background
Essentially, the key sequences in terminfo entries (particularly
khome and kend) are for full-screen applications only. This means
that they are only valid after an 'smkx' sequence, to put the
terminal into application mode. If you want to use these sequences
in non-application mode, you need to recognize similar sequences -
the versions which start with CSI (\E [) rather than SS3 (\E O).
One example of how is in /etc/zshrc in recent Debian ZSH packages.