rogual / neovim-dot-app

Mac OS X GUI for Neovim
1.13k stars 62 forks source link

Edit > Show Fonts malfunctions if current buffer is in Terminal mode #143

Open edrex opened 8 years ago

edrex commented 8 years ago

The command to show the font selector is output to the buffer instead, and the buffer ends in Normal mode:

:call MacShowFontSelector()
rogual commented 8 years ago

Oh, good find. I'm hoping terminal mode can be made to play nicely with the menu system — I seem to recall @tarruda isn't a menu user.

(Quick thought — this could also happen if your neovim binary is a bit old as it won't send the new mode-change messages to neovim.app)

Edit: Can reproduce, bug confirmed.

Edit 2: I think this will need a patch to Neovim. See https://github.com/rogual/neovim/blob/fafbfca51e001334aa27d77af67f12f626c9258a/src/nvim/menu.c#L1361 where it decides what to do with the chosen menu command:

    if (current_SID != 0)
      exec_normal_cmd(menu->strings[idx], menu->noremap[idx],
          menu->silent[idx]);
    else
      ins_typebuf(menu->strings[idx], menu->noremap[idx], 0,
          TRUE, menu->silent[idx]);

I believe we're getting the ins_typebuf branch when we want the exec_normal_cmd branch. Haven't run in a debugger so I may be wrong. Can't tell what current_SID is unfortunately, or why the menu command would ever need to go into the typebuf.

Edit 3: Vim's menu system was written before the async API that GUIs use was a thing. Here's the patch I sent them not so long back to fix it in insert and visual mode: https://github.com/neovim/neovim/pull/2992

We just™ need something similar for terminal insert mode.

bambu commented 8 years ago

And command mode :-p. It just so happens that I had opened up neovim/neovim#3386 yesterday. Thanks to you your post @rogual I was able to get a fix for it .

Trying to see if I can get it to work with terminal mode as well

rogual commented 8 years ago

Looks like we're waiting for https://github.com/neovim/neovim/issues/3393