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

TabNewEntered is not triggered when using <CTRL-W> T #4979

Closed
dmerejkowsky opened this Issue Jun 27, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@dmerejkowsky
Copy link
Contributor

dmerejkowsky commented Jun 27, 2016

  • nvim --version: NVIM v0.1.5-536-g9fb8adf
  • Vim (version: ) behaves differently? N/A
  • Operating system/version: Arch Linux
  • Terminal name/version: XFCE terminal
  • $TERM: xterm

Actual behaviour

TabNewEntered is not triggered when using <CTRL-W> T

Expected behaviour

TabNewEntered should be triggered

Steps to reproduce

" in bug.vim
function! OnTabEntered()
  echom "new tab"
endfunction

autocmd TabNewEntered * :call OnTabEntered()
nvim -u bug.vim
:e foo.c
:split
<CTRL-W> T # no message
:tabnew  # message is printed

Note: I've written a failing test on my branch

No clue on how to fix, though :P

@fmoralesc

This comment has been minimized.

Copy link
Contributor

fmoralesc commented Jun 28, 2016

I think this will fix it:

diff --git a/src/nvim/window.c b/src/nvim/window.c
index 4eaba3a..1298248 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -251,11 +251,14 @@ newwindow:
       if (win_new_tabpage((int)Prenum, NULL) == OK
           && valid_tabpage(oldtab)) {
         newtab = curtab;
-        goto_tabpage_tp(oldtab, TRUE, TRUE);
-        if (curwin == wp)
-          win_close(curwin, FALSE);
-        if (valid_tabpage(newtab))
-          goto_tabpage_tp(newtab, TRUE, TRUE);
+        goto_tabpage_tp(oldtab, true, true);
+        if (curwin == wp) {
+          win_close(curwin, false);
+        }
+        if (valid_tabpage(newtab)) {
+          goto_tabpage_tp(newtab, true, true);
+          apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, false, curbuf);
+        }
       }
     }
     break;

@justinmk justinmk added the bug label Jun 28, 2016

@justinmk justinmk added this to the 0.2 milestone Jun 28, 2016

@dmerejkowsky

This comment has been minimized.

Copy link
Contributor

dmerejkowsky commented Jun 28, 2016

@fmoralesc Applied your patch, test still fails. Will have a look later, this may be a good starting point :)

@fmoralesc

This comment has been minimized.

Copy link
Contributor

fmoralesc commented Jun 28, 2016

Ah, I tried it manually and it worked, so there's that ;) At any rate, I think the choices are either to modify it there, or modify the goto_tabpage_tp function so it handles new tabs.

dmerejkowsky added a commit to dmerejkowsky/neovim that referenced this issue Jun 28, 2016

@dmerejkowsky

This comment has been minimized.

Copy link
Contributor

dmerejkowsky commented Jun 28, 2016

Aha! It was a bug in the test, using <CTRL-W> instead of <C-W>

I've made a PR with your patch: #4984

@justinmk justinmk closed this in 4353656 Jun 29, 2016

justinmk added a commit that referenced this issue Jun 29, 2016

@HarmtH

This comment has been minimized.

Copy link
Contributor

HarmtH commented Jun 29, 2016

This bug was actually a sort of duplicate of #4334, could you have a look at that one too again @fmoralesc @dmerejkowsky ?

mgraczyk added a commit to mgraczyk/neovim that referenced this issue Jul 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment