kassio / neoterm

Wrapper of some vim/neovim's :terminal functions.
Other
1.32k stars 117 forks source link

> pull request was actually highjacking empty buffers #294

Closed kassio closed 4 years ago

kassio commented 4 years ago

pull request was actually highjacking empty buffers

What do you mean by this? It was making sure no empty buffer is created. Was it causing any issues for you?

On my flow I don't have this bug

I figured out that its caused when hidden is set. I guess then the empty buffer preserves. If hidden is not set it gets deleted. Maybe that's the reason why you don't have this bug. I have below some instructions how to reproduce it.

Minimal vimrc

cal plug#begin($XDG_DATA_HOME.'/nvim/plugins')
Plug 'kassio/neoterm'
cal plug#end()
set hidden

Steps to reproduce

  1. echo foo > foo
  2. nvim foo
  3. :Topen | b# | Topen | ls<cr>

Actual Behavior

The last command ls shows that besides foo also a second empty buffer with the name [No Name] exists.

Expected Behavior

No empty buffer should be created.

Cause of the Problem

The commit cb685fd makes the function s:create_window create a new empty buffer which doesn't get deleted when hidden is set.

https://github.com/kassio/neoterm/blob/dc94493b581ebef6607e4a2b399adf1003857fd0/autoload/neoterm.vim#L290

Originally posted by @astier in https://github.com/kassio/neoterm/issues/285#issuecomment-663830132

kassio commented 4 years ago

What do you mean by this?

Instead of creating a split window, when using that code, on re-opening a neoterm it opened in the current window (hijacking) the current window, instead of creating a split window even when passing a mod. Exemple:

hijack


Following the reproduce steps I wasn't able to replicate the error:

Kapture 2020-07-26 at 19 48 33

astier commented 4 years ago

Instead of creating a split window, when using that code, on re-opening a neoterm it opened in the current window (hijacking) the current window, instead of creating a split window even when passing a mod

In my case Topen opens a new terminal in the current window and not in a split-window. But you are right. It breaks reopening a terminal in a vertical split.

Following the reproduce steps I wasn't able to replicate the error

This is what I get:

neoterm

I saw in your last gif that when you try to open foo you get some error messages like it couldn't load something. And at the first line in the file foo there are some red markers. So it seams like its not really a minimal vimrc. If so could you pls repeat it with only the minimal vimrc which I posted above?

Other than that I really don't know what else could be the difference. I am using nvim v0.4.3 and neoterm with the latest commit f4399a0.

@collegeimprovements do you still have this bug? Could you try to reproduce the bug with the instructions I gave above?

astier commented 4 years ago

@kvalv do you still have this bug? Could you try to reproduce the bug with the instructions I gave above? I am mentioning you because you said that you have the bug in issue #285.

kassio commented 4 years ago

@astier you're right. I was able to replicate. Can you check if https://github.com/kassio/neoterm/pull/300 fixes it, please?

astier commented 4 years ago

It fixes the issue for me. I hope it doesn't break anything else. Thank you very much for your help.