Simplify conditionals on edit() and other minor changes on interactiveutil.jl

Ref: #8738
(cherry picked from commit 318e03bd5c0cddb1ecdd6907225e741532bf282a)