Giter Site home page Giter Site logo

Comments (11)

clason avatar clason commented on May 18, 2024 2

In particular, provide min.lua and test.file so we can run nvim --clean -u min.lua test.file and reproduce the issue (if necessary, with add debug output).

from neovim.

echasnovski avatar echasnovski commented on May 18, 2024 1

I've bisected it to 0081549 which was part of #24824.
cc @bfredl

from neovim.

bfredl avatar bfredl commented on May 18, 2024 1

The instructions above do not uniquely identify a situation. I could easily expand that script myself into some complete reproduction script, but so in multiple different ways. Depending on the missing details, the current behavior might or might not actually be the desired one (a change from 0.9.5 is not enough to identify a regression).

from neovim.

bfredl avatar bfredl commented on May 18, 2024 1

Trivially: OTHER_BUFFER_ID is not defined. and it is not clear at all what that should refer to in your step 2 and 4 respectively.

It is better to just provide a complete script directly, instead of having us guess stuff, to avoid any misunderstanding.

from neovim.

wojciech-kulik avatar wojciech-kulik commented on May 18, 2024 1

Here is the code to reproduce it... the buffer with the content is scrolled to top after setting lines. When you focus it again, the expected scroll position is restored.

local lines = {}
for i = 1, 100 do
  lines[i] = tostring(i)
end

vim.cmd(":new")
local newBuf = vim.api.nvim_get_current_buf()

vim.api.nvim_buf_set_lines(newBuf, 0, -1, false, lines)
vim.cmd(":50")

vim.cmd("vnew")
vim.api.nvim_buf_set_lines(newBuf, 0, -1, false, lines)

from neovim.

wojciech-kulik avatar wojciech-kulik commented on May 18, 2024

Workaround:

for i, line in ipairs(lines) do
  vim.api.nvim_buf_set_lines(M.bufnr, i - 1, i, false, { line })
end

from neovim.

wojciech-kulik avatar wojciech-kulik commented on May 18, 2024

@bfredl you didn't provide information on what is exactly missing. Reproduction steps have been provided and the video showing the situation is provided, plus you got the specific commit that changes this behavior. I think you have everything you need :).

from neovim.

pysan3 avatar pysan3 commented on May 18, 2024

@bfredl Could you please take a moment to review this issue as well? Here is the link: #27720

Although my issue may not be identical to the one described here, there is a possibility that they share the same root cause.

I have also included steps to reproduce the issue.

from neovim.

bfredl avatar bfredl commented on May 18, 2024

Thanks, it's clear now.

I cannot reproduce however on master ( 633bf61) with nvim --clean -u path/to/script.lua. Although the behavior you describe sounds like it could happen (for the same reasons as in #27720 (comment) ), am I missing something more?

from neovim.

wojciech-kulik avatar wojciech-kulik commented on May 18, 2024

Maybe it's a matter of timing.

When I call :luafile path/to/script.lua after nvim --clean -u path/to/script.lua it's reproducible.

from neovim.

wojciech-kulik avatar wojciech-kulik commented on May 18, 2024

Another related issue: #25370

from neovim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.