For native fullscreen, simply remove the custom animation as it doesn't
look good and doesn't look native. This was added back when resizing the
window rapidly would result in artifacts, but they should have all been
fixed. As such, no need to hide everything under a black fade.
For custom fullscreen, make it so that if `MMFullScreenFadeTime` is set
to 0 (which is now the default), the fading animation will simply not be
drawn as it simply flickers. Since it now defaults to 0, the user will
have to manually set this back to 0.25 to get the old functionality,
which is ok as it's somewhat a legacy feature anyway and there shouldn't
be any flickering now during the transition.
Also, update documentation on full-screen to provide more info on native
vs custom, and clean up old outdated texts.
Misc driveby fixes related to full screen:
- Robustify the Touch Bar full screen button to listen to `OptionSet`
event which is more robust than relying on `VimResized`, which also
didn't work when 'fuoptions' is set to nothing.
- Make MacVim handle the DidFailToEnter/ExitFullScreen events better.
These events could fire when using native full screen while the user
is e.g. switching space. We need to make sure to properly update the
states when these two events happen and let Vim know what the current
`'fullscreen'` state is so both sides are synced.
- Fix up the preferences pane's full screen buttons to not trigger
fontPropertiesChanged which was a mistake due to copy-and-paste in
Interface Builder.
See:
- #292 / #289 which implemented the fade effect.
Remove langmenu=none from the MacVim vimrc to enable Vim's menu
translations.
Menu cleanups:
- Remove Emoji character picker menu item as macOS already adds it
automatically to Edit menu. No need to do that ourselves.
- Rename some menus to fit macOS more and so we can use an official
Apple translations (e.g. Select Next Tab renamed to "Show Next Tab").
Also, modify extract-specific-localised-strings.swift for MacVim. This
sets up only the locales we need, and add a new mode to generate Vim
menu translations and can be toggled using a command-line parameter.
Vim menu translations
--------------------
Vim already has menu translations, but need to add translations for
MacVim-specific menus. Add menu translations for MacVim in a new
subfolder. Each locale has two new translation files: one with Apple
official translations extracted using the script, and the other one with
custom translations (they were mostly done by referencing existing
translations, e.g. "About MacVim"). Also added a README to try to make
it clear what's going on.
- Not all menu items are translated yet. There are a couple left (e.g.
"Toggle Full Screen" and "Stay in Front") but for it's good for now,
and we can add those translations in later.
MacVim xib translations
--------------------
Convert MainMenu.xib to Base localization and add per-locale strings
files. The top parts are the manually translated strings (well, mostly
from guessworks with help from Google translte), and the bottom parts
are the Apple official ones coming from the script. This mostly affects
the menu that's shown when no Vim instance is opened, and also the main
app menu called "MacVim". Other menu items when there is a window opened
use the Vim menu translations instead.
Other MacVim GUI items like preference pane are currently not localized
as those would likely need someone to go through and actually manually
translate them, and it would be tricky to keep them up to date if we
make changes, which happens from time to time.
Locales
--------------------
- No MacVim translations (Apple didn't have official translations for
them):
- af_af.latin1
- eo.utf-8
- is_is.utf-8
- sl_si.utf-8
- sr_rs.utf-8
- Added MacVim translations:
- ca_es
- cs_cz
- da
- de_de
- es_es
- fi_fi
- fr_fr
- hu_hu
- it_it
- ja
- ko_kr
- nl_nl
- no_no
- pl_pl
- pt_br
- pt_pt
- ru_ru
- sv_se
- tr_tr
- zh_cn
- zh_tw
Close#776
MacVim has previously not included vimtutor, meaning the user had to
obtain it elsewhere. Change the build scripts to copy it over to the app
bundle so that it's under MacVim.app/Contents/bin just like `mvim` etc.
Also, provide a Help menu item to open vimtutor. The menu action will
also make sure to override the PATH first to prevent accidentally
opening other installed MacVim/Vim versions since vimtutor works by
searching PATH instead of explicitly passing in the Vim executable path.
Also, make all Help menu items work in terminal mode as well as an easy
fix.
Can now specify submenus. E.g. TouchBar.Debugger.Run. When trying to
create a submenu it will first create a popover item and then only
create the NSButton at the leaf.
- Unfortunatley macOS currently can't do multiple levels of submenus (the
API will allow it, but it doesn't really work), presumably for
usability concerns. Limit it to only one level of nesting for now.
Add ability to set a title on a Touch Bar button, using `tmenu`. This
allows us to override the displayed button name, and when an icon is
specified the override name will still be shown alongside the icon.
Add emoji picker support, and add it to the list of default Touch Bar
menus. Only enable it in modes where the user is typing (insert,
command, terminal, etc).
Fixed up the internal implementation of Touch Bar management so it's
easier to add metadata to it now.
Also, add documentation.
TODO:
- Using `tmenu` after `amenu` doesn't really work (unless it's specified
in vimrc). This is because MacVim hasn't implemented
`gui_mch_menu_set_tip`. Should fix it by adding support for it. For
now, the user can just call `tmenu` before `amenu`.
- Disabling menus currently just hides the menu. Since the user can
already do `aunmenu` to hide, should change the disable behavior to
show the button but disabled instead, similar to how toolbars and
normal menus work.
Vim terminals use tlmenu to specify menu items and the normal `amenu`
doesn't work. This causes functionality such as toggling full screen and
going to next/prev tab to not work in terminal mode. Fix that by adding
the proper tlmenu mapping to the appropriate items.
Fix#1045
Problem: Buffer menu does not handle special buffers properly.
Solution: Keep a dictionary with buffer names to reliably keep track of
entries.
Also trigger BufFilePre and BufFilePost for command-line and
terminal buffers when the name changes.
Currently, when using special buffers like terminals / command-line
window / quickfix / location list, these buffers will get added to the
"Buffers" menu, but they don't get removed when the buffers are gone,
leaving stale menu items. Fix buffer menu to be more robust.
1. Currently the buffer menu works by using the buffer name to
add/remove the entries, but it's error-prone because the buffer could
have been renamed under-the-hood. While it uses BufFilePre/Post
autocommands to handle normal buffer renames, it doesn't work for the
command-line window (accessible via `q:`) which gets renamed without
sending the autocommand. Instead, change the menus to cached a
dictionary a bufnum -> menu name, so it will always know how to
remove a buffer from itself.
2. Add BufFilePre/Post autocommands to command-line windows when it
changes the buffer name to "[Command Line]".
3. Add BufFilePre/Post autocommands to terminal windows when it
changes the buffer name to the command, e.g. "!/bin/zsh".
Either (1) or (2)+(3) will fix the issue, but just doing all of them as
this seems like the right thing to do (2 + 3) also means the menu items
show the correct names instead of just saying "[No Name]".
This doesn't fix the following which needs to be fixed later:
1. Quickfix and Location List don't send BufDeleted autocmds. This leads
to them also leaving stale buffer menu items as there's no way for
the script to know that those buffers are gone.
Also add unit tests for cmdline-win / terminal buffer menus
Note: This fix misc test_cmdline failures in MacVim due to the menu item
not being able to be removed.
This is a duplicate of vim/vim#5787
Cmd-E (Edit -> Use Selection for Find") in most macOS apps follow the
convention that it shares to the system Find Pasteboard, while Cmd-G
uses the Find Pasteboard to find the next item. Make Cmd-E always do
that even if MMShareFindPboard is set to NO. This way, normal searches
in Vim wouldn't pollute the system find pasteboard, but could still have
a way to share to it by using this action.
MMShareFindPboard is supposed to prevent MacVim from updating the system
find pasteboard when searching, but the previous behavior was that it
would only set the Vim-specific format to the find pasteboard so you
could still share search patterns across Vim windows but it has the
effect of clearing the global find pasteboard. Just fix that by making
MacVim not touch the system find pasteboard at all when
MMShareFindPboard is set to NO to respect user's wish. Cmd-G will still
use the system find pasteboard to make it easy to search in another
macOS program and jump to Vim. The user can always use `n` instead if
that's not desired.
Also update docs to make this clear, and rename all "OS X" to "macOS" to
keep up with the times.
Close#773
Enabled states now work. E.g. a mapped Touch Bar button using "vmenu
TouchBar.DoStuff <nop>" will not show up in normal mode.
Also support specifying default Apple template icons. E.g. "an
icon=NSTouchBarListViewTemplate TouchBar.ShowList <Nop>"
Remove default TouchBar buttons as there were too many of them and most
of them are unlikely to be heavily used as there are direct Vim command
equivalent. Instead just add a single fullscreen toggle button. This can
be changed later.
Problem: Initializing menus can be slow, especially when there are many
keymaps, color schemes, etc.
Solution: Do the globbing for runtime files lazlily. (Ken Takata)
Added three window level functions to MMAppController. These allow the
window to float on top, stay on bottom or revert back to normal status.
I have also added the commands to the Actions.plist. The commands were
added using the menu.vim file.