Fix 7180 autodetect

This PR closes #7180

In the terminal: 
If maxcols == 0 then auto detect columns
if maxrows == 0 auto detect rows 

Todo: 
* Update the docs