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

Exit copy-mode when clearing terminal screen #233

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

tradiff
Copy link
Contributor

@tradiff tradiff commented Sep 20, 2024

Thanks for identifying and fixing the issue with reset in #230! What do you think about invoking reset from VimuxClearTerminalScreen() as well? Currently, this command does nothing if the Vim pane is in copy mode.

Ultimately my goal is for vim-test to clear the screen, clear the scrollback buffer, and run the tests. And do all of this regardless of whether the pane was left in copy-mode.

Right now, vim-test performs the following (reference):

    call VimuxClearTerminalScreen()
    call VimuxClearRunnerHistory()
    call VimuxRunCommand(s:command(a:cmd))

Since VimuxRunCommand is currently the only function that executes the reset sequence, the first two functions (VimuxClearTerminalScreen and VimuxClearRunnerHistory) do nothing in copy mode. This PR modifies VimuxClearTerminalScreen to also execute the reset sequence.

Other possible solutions

  1. A workaround could be to modify vim-test to execute call VimuxRunCommand("") before the three lines above, but that approach feels somewhat hacky.
  2. Another option could be to create a public VimuxReset() function that vim-test could call before executing the lines above. However, I believe VimuxClearTerminalScreen() should ideally handle exiting copy-mode itself.

@mvanderkamp
Copy link
Member

To play devil's advocate for a moment: since the sequence ends with a call to VimuxRunCommand, vim-test will already do what you describe.

Another thing to consider: what if there are other plugins, dotfiles, and/or users who depend on VimuxClearTerminalScreen not wiping the readline buffer?

@mvanderkamp
Copy link
Member

Oh sorry no I'm mistaken you won't quite clear everything.

I think we should avoid executing CTRL-u in the runner from VimuxClearTerminalScreen but I think it would make sense to quit copy mode.

@tradiff
Copy link
Contributor Author

tradiff commented Sep 20, 2024

@mvanderkamp Yeah good call. That seems to work for me. I pushed an update to this PR.

@tradiff tradiff changed the title Call Reset when clearing terminal screen Exit copy-mode when clearing terminal screen Sep 20, 2024
@tradiff
Copy link
Contributor Author

tradiff commented Sep 24, 2024

@mvanderkamp can this get merged, or do you have any other thoughts?

Copy link
Member

@mvanderkamp mvanderkamp left a comment

Choose a reason for hiding this comment

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

Sorry somehow I thought I'd approved it but I must not have clicked submit!

@alerque alerque merged commit 7db6b2f into preservim:master Sep 26, 2024
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