Skip to content

Autoclose is not respected if on_exit is set #445

@jiz4oh

Description

@jiz4oh

Before reporting

  • Please make sure you have searched through the F.A.Q. first.

  • Please make sure you are using the latest version of this plugin.

  • It's better to use English as it's more friendly to other non-Chinese native users.

Environment

If you are using neovim, just run :checkhealth floaterm and post the content

below.

- Platform: Darwin
- Nvim: NVIM v0.11.0
- Plugin: 4e28c8d

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

g:floaterm_autoclose

Describe your question, feature request, or bug.

I am setting my wrapper function by calling floaterm#new and the autoclose=0 param is useless if set on_exit in jobopts due to the hardcode logic.

Steps to reproduce

Using the minimal vimrc

set nocompatible
set hidden
set termguicolors
set runtimepath^=~/.vim/bundle/vim-floaterm
filetype plugin indent on
syntax on

function Cb(...)
  echom 123
endfunction

function Test()
   " it's working as expected
   call floaterm#new(0, 'echo 111', {}, { 'autoclose': 0 })
   " it's not working
   call floaterm#new(0, 'echo 111', { 'on_exit': function('Cb') }, { 'autoclose': 0 })
endfunction

Steps to reproduce the behavior:

Actual behaviour

always close the terminal buffer

Expected behaviour

do not close the terminal buffer if the autoclose = 0

probably solution is

if (autoclose == 1 && (a:data == 0 || (a:callback isnot v:null))) || (autoclose == 2)

Screenshots(Optional, GIF is better)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions