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

[Windows][Powershell] Can't scroll preview when using git-delta in commits panel #2764

Open
searleser97 opened this issue Oct 31, 2023 · 8 comments · May be fixed by #2810
Open

[Windows][Powershell] Can't scroll preview when using git-delta in commits panel #2764

searleser97 opened this issue Oct 31, 2023 · 8 comments · May be fixed by #2810
Labels
bug Something isn't working Windows Relates to window operating system

Comments

@searleser97
Copy link

searleser97 commented Oct 31, 2023

Description

<C-D> and <C-U> do not scroll when using git delta as previewer for commits in windows powershell

Neovim version

NVIM v0.10.0-dev-953+g1635c9e75
Build type: RelWithDebInfo
LuaJIT 2.1.1693019600

Operating system and version

Windows 11

Telescope version / branch / rev

master

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0 (rev af6b6c543b)
- OK fd: found fd 8.7.0

===== Installed extensions ===== ~

Telescope Extension: `file_browser` ~
- No healthcheck provided

Telescope Extension: `harpoon` ~
- No healthcheck provided

Telescope Extension: `live_grep_args` ~
- No healthcheck provided

Telescope Extension: `recent_files` ~
- No healthcheck provided

Steps to reproduce

  1. open git commits panel with gc based on the mapping listed below (minimal config section)
  2. observe that you can not scroll through the preview

Expected behavior

be able to scroll the preview with <c-d> and <c-u> when using git delta as pager

Actual behavior

<c-d> and <c-u> do not work when using git delta as pager

Minimal config

local telescope_builtin = require('telescope.builtin')
local previewers = require('telescope.previewers')

local delta_previewer = previewers.new_termopen_previewer {
  get_command = function(entry)
    return { 'git', '-c', 'core.pager=delta', '-c', 'delta.side-by-side=false', 'diff', entry.value .. '^!' }
  end
}
vim.keymap.set("n", "gc", function ()
  telescope_builtin.git_commits({
    previewer = delta_previewer
  })
end, { noremap = true, desc = "git branch commits" })
@searleser97 searleser97 added the bug Something isn't working label Oct 31, 2023
@searleser97
Copy link
Author

@tjdevries Could you point me in the right direction of how I could fix this ? I am open to contribute, but hard to know where to start

Thanks

@jamestrew jamestrew added the Windows Relates to window operating system label Nov 4, 2023
@jamestrew
Copy link
Contributor

Seems to be working fine on Linux.
I'm not sure what's happening on Windows to cause this issue.

@searleser97
Copy link
Author

Looks like this is the line that is not working correctly for windows, any ideas ?

vim.fn.chansend(term_id, termcode)

@searleser97
Copy link
Author

Tested with ToggleTerm, and sending commands there work as expected on Windows (I can scroll delta pager by sending "10d" for example).

Looks like the same "chansend" command is used, probably we still have hope
https://github.com/akinsho/toggleterm.nvim/blob/91be5f327e42aa016da13b277540de8dba0b14e3/lua/toggleterm/terminal.lua#L317-L328

@searleser97
Copy link
Author

Tested with ToggleTerm, and sending commands there work as expected on Windows (I can scroll delta pager by sending "10d" for example).

Looks like the same "chansend" command is used, probably we still have hope https://github.com/akinsho/toggleterm.nvim/blob/91be5f327e42aa016da13b277540de8dba0b14e3/lua/toggleterm/terminal.lua#L317-L328

I tried appending "\r" as in toggleterm but still not working :(

Any more ideas ? @jamestrew @tjdevries @henrik

@jamestrew
Copy link
Contributor

Thanks @searleser97 for doing this digging.

Give me a few days to let me take a closer look.

@searleser97
Copy link
Author

searleser97 commented Dec 14, 2023

Probably this scroll_bottom function is what makes the magic in toggleterm

https://github.com/akinsho/toggleterm.nvim/blob/91be5f327e42aa016da13b277540de8dba0b14e3/lua/toggleterm/terminal.lua#L321C23-L321C23

@searleser97
Copy link
Author

So, this is what worked for me:

image

image

@searleser97 searleser97 linked a pull request Dec 14, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Relates to window operating system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants