pinentry-curses will exit without cleaning up the terminal if it's attempt to
draw it's curses window when the terminal is outside of the required size (as
invoked by gpg-agent 2.0.18 the dimensions are 10 lines X 79 columns)
To reproduce:
unset DISPLAY
Resize your terminal to a size less than 10x79 and then perform any action which
will cause gpg-agent to invoke pinentry. Running reset will be required
afterward.
I do not think that pinentry-curses necessarily needs to support terminals this
size as it is rather uncommon, I would however suggest that it is advantageous
to exit cleanly and perhaps print an explanatory warning if the terminal is
undersized.