--trim-terminal-gaps and more

1) New switch --trim-terminal-gaps switch to hone in on specified reference sequence.  
2) If not specified av detects terminal height and width and fits layout accordingly. 
3) Refactored and simplified but retained native code layout and style.  Also removed some unnecessary loops to gain a little extra speed.

Tests passed
* pdf output