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

feat: add output_panel.clear() #249

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

marcelbeumer
Copy link
Contributor

Often while re-running tests it's hard to see what is output of the current run and output of the last run.

By manually wiring clear() into my bindings I can choose when to clear and when not.

Copy link
Collaborator

@rcarriga rcarriga 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 the PR, love the idea! Just a small change then LGTM 😄

--- <
function neotest.output_panel.clear()
if chan then
vim.api.nvim_chan_send(chan, "\x1b[H\x1b[2J")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This only clears the visible section of the output panel. A clear function should completely remove the output.
Can do this with

  nio.api.nvim_buf_set_option(panel.win:buffer(), "modifiable", true)
  nio.api.nvim_buf_set_lines(panel.win:buffer(), 0, -1, false, {})
  nio.api.nvim_buf_set_option(panel.win:buffer(), "modifiable", false)

@thuan1412
Copy link

Hi @marcelbeumer, could you continue this PR? If not, how may I assist you to complete it? I really need this feature.

@rcarriga rcarriga merged commit da628ed into nvim-neotest:master Oct 20, 2023
4 checks passed
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.

3 participants