[Fix #516] Define ZLE functions separately
[Fix #522] Do not load the terminal module in non-graphical terminals