nvim-ipy icon indicating copy to clipboard operation
nvim-ipy copied to clipboard

Output in console buffer lets cursor jump in other buffers

Open languitar opened this issue 10 years ago • 10 comments

If I produce output inside the ipython/jupyter kernel buffer, the cursor in another buffers jumps somewhere, even if the jupyter buffer isn't visible.

languitar avatar Jan 12 '16 14:01 languitar

Cannot reproduce. Do you have more complete steps to reproduce? Btw the code that moves the cursor is

    for w in self.vim.windows:
        if w.buffer == self.buf:
            w.cursor = [len(self.buf), int(1e9)]

which should only move the cursor in the jupyter buffer. But this reminds me this should be made dynamically configurable, which should be easy now that we have neovim/neovim#3603

bfredl avatar Jan 13 '16 10:01 bfredl

Steps to reproduce:

  1. start nvim with some python file
  2. :IPython
  3. Focus python file again
  4. C+w o so that the python file is the only visible one
  5. move cursor somewhere
  6. In a new shell: jupyter console --existing
  7. In that shell, enter some python code, e.g. 2+3

Cursor in vim moves to first line in the python file

NVIM v0.1.1-165-g074d3dc (compiled Jan 4 2016 11:10:24)

languitar avatar Jan 13 '16 14:01 languitar

I cannot reproduce on bf7bc4dcf (master 18 hours ago). It could possible that the startup is racy with some autocommands or something. Could you try with minimal nvimrc with only this plugin?

bfredl avatar Jan 14 '16 22:01 bfredl

This also happens with this minimal config: https://github.com/languitar/config-vim/tree/nvim-ipy-bug

The important part seems to be that this only happens if the ipython buffer is not shown in a window.

languitar avatar Jan 15 '16 09:01 languitar

hmm weird, and always moves to the first line, even if you do it many times? Just for debugging try add return as the first line in append_outbuf in rplugin/python/nvim_ipy.py and see if still happens.

bfredl avatar Jan 15 '16 10:01 bfredl

file-optimized

Here is a badly made screencast showing what I experience. It seems this only happens the first time the ipython buffers gets to the background.

languitar avatar Jan 18 '16 08:01 languitar

Did you try with disabled append_outbuf as I suggested above?

bfredl avatar Jan 20 '16 10:01 bfredl

Without that the cursor does not jump.

languitar avatar Jan 20 '16 10:01 languitar

If you just remove this part

    for w in self.vim.windows:
        if w.buffer == self.buf:
            w.cursor = [len(self.buf), int(1e9)]

does it still happen?

bfredl avatar Jan 20 '16 10:01 bfredl

With these three lines removed the issue still exists.

languitar avatar Jan 20 '16 13:01 languitar