IDEA-57940 Cyclic expand word should take into account all open files
(cherry picked from commit f748505)