easymotion / vim-easymotion

Vim motions on speed!
http://www.vim.org/scripts/script.php?script_id=3526
7.5k stars 362 forks source link

EasyMotion#is_active gives wrong result #388

Open chemzqm opened 6 years ago

chemzqm commented 6 years ago

I have this in my node code:

    setInterval(async () => {
      let active = await this.nvim.call('EasyMotion#is_active')
      logger.debug('active:', active)
    }, 300)
18-10-04T17:27:11.865 DEBUG (pid:58844) [workspace] - active: 0
2018-10-04T17:27:11.865 DEBUG (pid:58844) [workspace] - active: 0
2018-10-04T17:27:11.865 DEBUG (pid:58844) [workspace] - active: 0
2018-10-04T17:27:11.865 DEBUG (pid:58844) [workspace] - active: 0
2018-10-04T17:27:11.899 DEBUG (pid:58844) [events] - Autocmd: CursorMoved [ 1 ]
2018-10-04T17:27:11.899 DEBUG (pid:58844) [events] - Autocmd: TextChanged [ 1 ]
2018-10-04T17:27:11.902 DEBUG (pid:58844) [workspace] - active: 1
2018-10-04T17:27:11.902 DEBUG (pid:58844) [workspace] - active: 1
2018-10-04T17:27:12.203 DEBUG (pid:58844) [workspace] - active: 1

The active would be 0 when start selecting jump position, and 1 after a position selected. Don't know if this is intended, but current behavior makes it it impossible for other plugin to skip emit buffer change event when the buffer change was caused by easymotion.

chemzqm commented 6 years ago

This would be resolved if there's a global variable indicate that easymotion is changing the buffer or not, the call of EasyMotion#is_active could be slow since it would source the vim file.