Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI shifts to the left and gets cut off when making an amend (when using floating window) #3832

Open
alivault opened this issue Aug 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@alivault
Copy link

Bug
When I amend a commit, the lazygit UI shifts to the left and gets cut off (when using a floating window in neovim).

Steps to reproduce the behavior:

  1. open lazygit in a floating window in neovim
  2. amend a commit
  3. observe the UI shifts to the left and gets cut off

Expected behavior
The UI should not shift to the left when amending a commit

Screenshot:
Screenshot 2024-08-15 at 3 50 45 PM

Version info:

  • lazygit commit=71ad3fac63a3ef3326021837b49e9497d332818b, build date=2024-07-13T10:24:19Z, build source=binaryRelease, version=0.43.1, os=darwin, arch=arm64, git version=2.46.0
  • git version 2.46.0
@alivault alivault added the bug Something isn't working label Aug 17, 2024
@jxddk
Copy link

jxddk commented Oct 22, 2024

I have the same issue when using Lazygit in a Neovim floating window, although it's not limited to amending commits; the issue appears intermittently when hiding and showing the floating window. Hiding and showing the window again fixes the issue (until the next hide/show cycle).

I have an identical issue with Lazydocker, so the issue is not strictly related to this repository.


Version and system information:

$ lazygit --version
commit=, build date=, build source=homebrew, version=0.44.1, os=darwin, arch=arm64, git version=2.47.0
$ nvim --version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
Run "nvim -V1 -v" for more info
$ tmux display -p '#{pane_width}x#{pane_height}'
258x70
● vim-floaterm
    url    https://github.com/voldikss/vim-floaterm
    branch master
    commit 4e28c8d

@jxddk
Copy link

jxddk commented Oct 23, 2024

After a little investigation, it seems like the root of the issue is that the buffer in Neovim's floating window scrolls to the right and gets stuck there. You can manually fix the scrolling problem while in Neovim with <C-\><C-n>ze.
While that may be initially caused by Lazygit's UI framework adding unnecessary blank columns to its right side, I came up with a hacky workaround in my Neovim configuration:

vim.api.nvim_create_autocmd({ "BufEnter" },
  {
    pattern = { "term://lazygit" },
    callback = function()
      vim.schedule(function()
        -- Send keys `ze` to scroll left...
        vim.api.nvim_feedkeys(
          vim.api.nvim_replace_termcodes('<C-\\><C-n>zei', true, true, true),
          'i',
          true)
        -- ...and try (_try_) to disable horizontal scrolling in the buffer
        vim.cmd("set sidescrolloff=" .. vim.o.columns)
        vim.cmd("redraw!")
        end
      end)
    end
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants