fix dialog display problem

the original code did not make the size of dialog fit in each screen size, in some resolutions, the terminal box is out of the dialog. fix this by using relative size.