NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.62k stars 218 forks source link

fix: do not use `normal ex` cmd for process refresh #1409

Closed PriceHiller closed 3 days ago

PriceHiller commented 3 days ago

As a heads up, I'm unsure if there are issues open (or opened previously) that related to this. I, at least, couldn't find any.

Copied from the body of the commit:

Problem: Currently normal ex commands don't work in terminal mode in Neovim. Currently the ProcessBuffer in Neogit displays long running git commands by default in a terminal buffer and sets the cursor to the bottom of the buffer on refresh via normal G which causes an error.

See https://github.com/neovim/neovim/issues/4895 which is the tracking issue in Neovim for normal ex commands in terminal mode.

Solution: Use Neovim's API to explicitly set the cursor position within the ProcessBuffer, avoiding invoking an normal ex

Using the following pre-commit git hook:

local count=0
while :; do
    count="$((count + 1))"
    printf "COUNT: %d\n" "${count}"
    sleep 1
done

I was able to test this issue. See the before and after below.

Before

before-fix.webm

After

after-fix.webm

Let me know if any further changes are desired 🙂

CKolkey commented 3 days ago

10/10, no notes :D