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

fix scrolling not working in term previewers for windows #2810

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

searleser97
Copy link

Description

Fixes #2764

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

refer to the issue that this PR fixes for details ( #2764 )

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@searleser97
Copy link
Author

cc @jamestrew

Copy link
Contributor

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the initiative on this.
Just a few thoughts + need to run stylua to pass CI.

@@ -225,7 +225,8 @@ previewers.new_termopen_previewer = function(opts)
return
end

vim.fn.chansend(term_id, termcode)
vim.fn.chansend(term_id, termcode .. (utils.is_windows() and "\r\n" or ""))
vim.api.nvim_buf_call(self.state.termopen_bufnr, function() vim.cmd("normal! G") end)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you found that this was necessary on windows? just confirming.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, working like a charm in Windows 11

@@ -225,7 +225,8 @@ previewers.new_termopen_previewer = function(opts)
return
end

vim.fn.chansend(term_id, termcode)
vim.fn.chansend(term_id, termcode .. (utils.is_windows() and "\r\n" or ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you try this? the docs say when passing a list, we can include an final empty string to send a final newline. That might simplify things and remove the need to check for is_windows.

Suggested change
vim.fn.chansend(term_id, termcode .. (utils.is_windows() and "\r\n" or ""))
vim.fn.chansend(term_id, { termcode, "" })

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this, we will also affect unix-like systems with change, have you tested it preserves the same behavior on unix-like systems ? I will do the windows test next week

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah my suggestion works on Linux. Just curious if it will on windows as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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