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: blank preview w/ glow 1.5.0 #107

Merged
merged 9 commits into from
Mar 3, 2023
Merged

Conversation

pyqlsa
Copy link
Contributor

@pyqlsa pyqlsa commented Feb 7, 2023

While using the semantics introduced in 83f1840, glow 1.5.0 is immediately SIGTERM'd upon execution of jobstart(). During testing, it was observed that the introduction of pty = true to the options for jobstart() would allow for successful execution while leveraging the linked executions semantics (avoiding the SIGTERM), but output would render very slowly (~2-5 seconds). Avoiding the job_control semantics and leveraging vim.loop directly appears to allow for successful output presentation and avoid delayed output rendering.

This PR also bumps the glow version to 1.5.0.

lua/glow.lua Outdated
end
end,
})
job_id = vim.fn.termopen(cmd, term_opts)
Copy link
Owner

Choose a reason for hiding this comment

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

was hoping to not use this function anymore since it brings a really bad Process Exited [0] msg at the end of the preview. The nvim_open_term function was fixing that, but with the new glow version, that stopped working. Can we stick with the old behavior somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, Process Exited [0] is less than ideal. I'll see if there is a way to avoid that message at the end of the preview. In the meantime, I'll convert this to a draft.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ellisonleao I believe I have an updated solution that successfully leverages nvim_open_term so that we can avoid Process Exited [0].

@pynappo I'm also curious if this helps resolve the behavior you were seeing on Windows (or if it introduces new/different issues). This works for me on Linux.

@pyqlsa pyqlsa marked this pull request as draft February 10, 2023 06:51
@pyqlsa pyqlsa changed the title fix: blank preview w/ glow 1.5.0 [wip] fix: blank preview w/ glow 1.5.0 Feb 10, 2023
@pyqlsa pyqlsa marked this pull request as ready for review February 12, 2023 03:02
@pyqlsa pyqlsa changed the title [wip] fix: blank preview w/ glow 1.5.0 fix: blank preview w/ glow 1.5.0 Feb 12, 2023
@pyqlsa
Copy link
Contributor Author

pyqlsa commented Feb 18, 2023

cc @ellisonleao friendly bump

lua/glow.lua Outdated
local function on_output(err, data)
if err then
-- what should we really do here?
print("[Glow Error] " .. vim.inspect(err))
Copy link
Owner

Choose a reason for hiding this comment

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

can we use vim.api.nvim_err_writeln here instead of print?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

absolutely!

@ellisonleao ellisonleao mentioned this pull request Feb 28, 2023
@ellisonleao ellisonleao self-requested a review March 3, 2023 02:31
@ellisonleao ellisonleao merged commit 392b23c into ellisonleao:main Mar 3, 2023
@ellisonleao
Copy link
Owner

Thanks @pyqlsa

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.

2 participants