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

Cursor stuck and gvim crashes when the terminal popup is toggled in two different tabs #390

Open
1 of 3 tasks
char101 opened this issue Feb 1, 2023 · 2 comments
Open
1 of 3 tasks
Assignees

Comments

@char101
Copy link

char101 commented Feb 1, 2023

Environment

GVim

If you are using vim(not neovim), fill in the following blanks

  • Output of vim --version: 9.0.1270

  • Platform:

    • Linux
    • Mac OS X
    • Windows

Configurations related to vim-floaterm in vimrc(i.e. g:floaterm_xxx):

map <silent> <F1> :FloatermToggle<CR>
tmap <silent> <F1> <C-w>:FloatermToggle<CR>

Describe your question, feature request, or bug.

Toggling the popup (using F1 as mapped above) in two different tabs causes the cursor in the other tab to be locked. Pressing F1 again in any of the tabs will crash gvim.

Steps to reproduce

Steps to reproduce the behavior:

  1. Open two blank tabs
  2. Press F1 in the first tab
  3. Press F1 in the second tab
  4. Cursor in the first tab will be stuck
  5. Pressing F1 in the first or second tab will crash gvim

I think if the popup is opened in a tab, then existing popup in other tab should be closed first.

@sankl
Copy link

sankl commented Dec 29, 2023

Stable reproducible and very annoying. It seems BufHidden autocmd is not running for open floaterm popup when tabs are switched. Adding BufLeave to autoload/floaterm/terminal.vim L20 makes auto-hiding work and the crash is gone. Please update.

@sankl
Copy link

sankl commented Dec 30, 2023

Something like this in .vimrc can be used as a workaround:

function! FloatermHide()
    if &filetype == 'floaterm'
        call floaterm#window#hide(bufnr('%'))
    endif
endfunction
autocmd! BufLeave * call FloatermHide()

It closes the popup when tabs are switched.

@voldikss voldikss self-assigned this Dec 30, 2023
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

3 participants