Use `fit-window-to-buffer' instead of `set-window-text-height'.
Attach a file by drag & drop or click to upload