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

Use VtrClearSequence to clear buffer history #106

Open
AlexChalk opened this issue Mar 31, 2021 · 2 comments
Open

Use VtrClearSequence to clear buffer history #106

AlexChalk opened this issue Mar 31, 2021 · 2 comments

Comments

@AlexChalk
Copy link

Hi,

I'm trying to use the VtrClearSequence value to issue a tmux clear-history command to my attached pane before sending a command, and it seems like a reasonable use case for a clear command. I want to be able to e.g. run tests and search my buffer for errors without finding results from my previous test run.

I checked the source code, and it seems like the clear sequence is used something like this: !tmux send-keys -t ~pane#~ ~clear-sequence~ ~main-command~. The problem is that executing clear-history like this, e.g. !tmux send-keys -t 1 "tmux clear-history" Enter, well, doesn't clear the history of the pane!

I guess there's something going on with how this command is executed that I don't understand; maybe clear-history doesn't understand the context in which it's been executed when it's run via send-keys? Do you have any ideas about what might be going on?

Thanks for any help you can provide!

@christoomey
Copy link
Owner

Hmm, the use case you're describing isn't exactly supported by the current commands, unfortunately. VtrClearSequence is intended to be a key sequence, e.g. Ctrl-l that can be sent to the shell session within a tmux pane, rather than tmux itself. clear-history is a tmux command, so they're operating at a different level.

To support your use case, I think we'd need to add a new VtrClearRunnerHistory command which under the hood executes tmux clear-history -t <runner-pane>. I'd welcome a PR that implements that if you're interested in poking around, but likely won't have time to tackle in the near term.

Hope that helps, or at least clarifies!

@AlexChalk
Copy link
Author

It does, thanks! I'll see how busy I am ;)

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

No branches or pull requests

2 participants