Fixes endless horizontal scrolling in the file tree

Fix for #9327 

(Note that this includes #9355 and should land after that one).
remove dead code