Coder Social home page Coder Social logo

Comments (10)

dbatten5 avatar dbatten5 commented on July 21, 2024 1

Getting this issue as well. I'll add that I'm using diffview and if I run :DiffviewOpen then I don't see this issue

from neogit.

miguno avatar miguno commented on July 21, 2024

Same here. I am using diffiview.nvim, too, and I don't see this when calling :DiffviewOpen manually.

from neogit.

murtaza64 avatar murtaza64 commented on July 21, 2024

hmm... I get this both with neogit and diffview

edit: that only happens when I open diffview after opening neogit diff

from neogit.

miguno avatar miguno commented on July 21, 2024

Yes, exactly. When I open diffview separately (without going through neogit), then everything looks fine and as expected. The issue reported here happens only when I first open neogit, and then use a neogit sub-command like dd to then open diffview from neogit.

from neogit.

murtaza64 avatar murtaza64 commented on July 21, 2024

I bet this is a \n vs \r\n issue? but I'm on a mac and don't work with windows devs so 🤷

from neogit.

eternity74 avatar eternity74 commented on July 21, 2024

I am having the same problem and I am using it on linux.
After debugging a while, looks the problem is related trim() https://github.com/NeogitOrg/neogit/blob/master/lua/neogit/lib/git/cli.lua#L1003
It seems empty line is removed by trim()
After I put {trim = false} to https://github.com/NeogitOrg/neogit/blob/master/lua/neogit/integrations/diffview.lua#L97
like
local fdata = neogit.cli.show.file(path).call_sync({ trim = false }).stdout
The problem is gone.

from neogit.

eternity74 avatar eternity74 commented on July 21, 2024

Hmm, After applying my change, it shows empty line at the last line.
Maybe it is related to https://neovim.io/doc/user/channel.html#on_stdout

The callback is invoked immediately as data is available, where a single-item list [''] indicates EOF (stream closed).

But I'm not sure. Need to check.

from neogit.

CKolkey avatar CKolkey commented on July 21, 2024

lemme know if if you need any pointers ;)

from neogit.

eternity74 avatar eternity74 commented on July 21, 2024

@CKolkey
I think the additional empty line of the file is added by EOF marker ['']
Current implementation of handle_output (https://github.com/NeogitOrg/neogit/blob/master/lua/neogit/process.lua#L285) is not handling channel.

I think if channel provides lines as below
["abc"]
[""] <-- complete line
["def"]
[""] <-- complete line
[""] <-- EOF
then stdout should be
"abc"
"def"
(EOF)
but current implementation maybe makes
"abcdef"

from neogit.

eternity74 avatar eternity74 commented on July 21, 2024

I am trying to modify call_sync to use plenary.job instead of neogit.process.

from neogit.

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.