vim-denops / deno-denops-std

📚 Standard module for denops.vim
https://jsr.io/@denops/std
MIT License
57 stars 17 forks source link

Inconsistent result of popup window between Vim and Neovim #274

Closed lambdalisue closed 2 weeks ago

lambdalisue commented 2 weeks ago

Describe the bug

It seems popup.open place floating window on Neovim in wrong place.

It seems Vim's col/row starts from 1 but Neovim starts from 0. We should consider the col/row starts from 1 in both case (I'm not sure. We need to make sure this before fix.)

Provide a minimal vimrc with less than 50 lines to reproduce

set nonumber
set signcolumn=no

" Optional
set showtabline=0

call denops#request('whateverdenopsplugin', 'popup', [])
import type { Entrypoint } from "jsr:@denops/std@^7.0.0";
import * as popup from "jsr:@denops/std@^7.0.0/popup";

export const main: Entrypoint = (denops) => {
  denops.dispatcher = {
    async popup() {
      await popup.open(denops, {
        relative: "editor",
        width: 3,
        height: 3,
        col: 5,
        row: 5,
        highlight: {
          normal: "IncSearch",
        },
      });

      await popup.open(denops, {
        relative: "editor",
        width: 3,
        height: 3,
        col: 10,
        row: 5,
        border: "single",
        highlight: {
          normal: "IncSearch",
        },
      });
    },
  };
};

How to reproduce the problem from Vim startup

:source test.vim

Expected behavior

Both Vim and Neovim place window in same location.

Actual behavior

It seems Neovim put floating window in invalid location.

Screenshots (if need)

Your environment

Additional context

CleanShot 2024-11-12 at 00 51 49

CleanShot 2024-11-12 at 00 56 42

CleanShot 2024-11-12 at 00 51 22

CleanShot 2024-11-12 at 00 57 16

Files

12345678901234567890123456789
2        1         2
3
4
5
6
7
8
9
10
11
12
13
14
15