-
-
Notifications
You must be signed in to change notification settings - Fork 821
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
base: master
Are you sure you want to change the base?
Conversation
cc @jamestrew |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 "")) |
There was a problem hiding this comment.
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
.
vim.fn.chansend(term_id, termcode .. (utils.is_windows() and "\r\n" or "")) | |
vim.fn.chansend(term_id, { termcode, "" }) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Description
Fixes #2764
Type of change
Please delete options that are not relevant.
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: