Correctly calculate the width left, used by the input box.

Margins, paddings and borders are taken into the calculation.