core: fix window/buffer pointers used in command /eval

(cherry picked from commit 421c0752d8fe3cf37d8c4b3ff13d4fe3dcb69034)