benlubas/molten-nvim

[Bug] Output Window Shown In The Wrong Window

dvnatanael opened this issue · 3 comments

  • OS: Windows 11
  • NeoVim Version: v0.9.5
  • Python Version: 3.11.8
  • Python is installed with: python installer
  • Health checks
`:checkhealth molten`
==============================================================================
molten: require("molten.health").check()

molten-nvim ~
- OK NeoVim >=0.9
- OK Python >=3.10
- OK Python module pynvim found
- OK Python module jupyter-client found
- OK Python module cairosvg found
- OK Python module pnglatex found
- OK Python module plotly found
- OK Python module kaleido found
- OK Python module pyperclip found
- OK Python module nbformat found
- OK Python module pillow found
`:checkhealth provider` (the python parts)
==============================================================================
provider: health#provider#check

Python 3 provider (optional) ~
- Using: g:python3_host_prog = "$HOME/venv/neovim/Scripts/python.exe"
- Executable: $HOME\venv\neovim\Scripts\python.exe
- Python version: 3.11.8
- pynvim version: 0.5.0
- OK Latest pynvim is installed.

Python virtualenv ~
- $VIRTUAL_ENV is set to: D:\test_molten\.venv
- Python version: 3.11.8
- OK $VIRTUAL_ENV provides :!python.

Description

When showing the output window from a split that is not at the edge of the screen, the output window is shown in the subsequent window instead of the current one.
Window 1
Window 2

Reproduction Steps

  1. Launch Neovim
  2. Create at least 3 vertical splits
  3. Go to a window that is not at the edge of the screen (i.e. the second window)
  4. Evaluate Python code
  5. Open the output window (if needed)
  6. The output window will be shown in the subsequent window
Minimal config

init.lua

vim.g.python3_host_prog = "$HOME/venv/neovim/Scripts/python.exe"

-- bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  }
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup {{
  "benlubas/molten-nvim",
  version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes
  build = ":UpdateRemotePlugins",
  init = function()
    vim.g.molten_auto_open_output = false
    vim.g.molten_enter_output_behavior = "open_and_enter"
    -- vim.g.molten_output_show_more = true
    vim.g.molten_output_virt_lines = true
    vim.g.molten_output_win_max_height = 30
    vim.g.molten_use_border_highlights = true
    vim.g.molten_virt_text_output = true
    vim.g.molten_virt_text_max_lines = 12
  end,
}}

stdpath("data").."/rplugin.vim"

" python3 plugins
call remote#host#RegisterPlugin('python3', stdpath("data")..'\\\\lazy\\\\molten-nvim\\\\rplugin\\\\python3\\\\molten', [
      \ {'sync': v:true, 'name': 'MoltenDeinit', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenDelete', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEnterOutput', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenReevaluateCell', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateLine', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateOperator', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateVisual', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenExportOutput', 'type': 'command', 'opts': {'bang': '', 'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenGoto', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenHideOutput', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenImagePopup', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenImportOutput', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenInfo', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenInit', 'type': 'command', 'opts': {'complete': 'file', 'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenInterrupt', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenLoad', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenNext', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenOpenInBrowser', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenPrev', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenReevaluateAll', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenRestart', 'type': 'command', 'opts': {'bang': '', 'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenSave', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenShowOutput', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateArgument', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateRange', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenAvailableKernels', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenBufLeave', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenRunningKernels', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenDefineCell', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOperatorfunc', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'MoltenSendStdin', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenTick', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'MoltenTickInput', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnBufferUnload', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnCursorMoved', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnExitPre', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnWinScrolled', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenStatusLineInit', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenStatusLineKernels', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenUpdateInterface', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenUpdateOption', 'type': 'function', 'opts': {}},
     \ ])
pip freeze
attrs==23.2.0
black==24.2.0
cairocffi==1.6.1
CairoSVG==2.7.1
cffi==1.16.0
click==8.1.7
colorama==0.4.6
cssselect2==0.7.0
defusedxml==0.7.1
fastjsonschema==2.19.1
greenlet==3.0.3
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter_client==8.6.1
jupyter_core==5.7.2
kaleido==0.2.1
msgpack==1.0.8
mypy==1.8.0
mypy-extensions==1.0.0
nbformat==5.10.4
neovim==0.3.1
packaging==23.2
pathspec==0.12.1
pillow==10.3.0
platformdirs==4.2.0
plotly==5.21.0
pnglatex==1.1
pycparser==2.22
pynvim==0.5.0
pyperclip==1.8.2
python-dateutil==2.9.0.post0
pywin32==306
pyzmq==26.0.0
referencing==0.34.0
rpds-py==0.18.0
ruff==0.3.0
six==1.16.0
tenacity==8.2.3
tinycss2==1.2.1
tornado==6.4
traitlets==5.14.2
typing_extensions==4.10.0
webencodings==0.5.1

Expected Behavior

The output window should be shown in the window where the code was ran (i.e. the second window).

Woah, I tested with two windows, but never three. Thanks for pointing this out!

@dvnatanael if you want to confirm this works for you as well that'd be appreciated

Works like a charm! Thanks~