From 3df190c29634aa180bd6a041ba87243161680fbf Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Sun, 18 Nov 2018 19:29:47 -0800 Subject: [PATCH 1/2] Fix MMShareFindPboard not working properly and update docs 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 --- runtime/doc/gui_mac.txt | 86 +++++++++++++++++---------------- runtime/doc/tags | 21 ++++++++ runtime/menu.vim | 2 +- src/MacVim/MMWindowController.m | 5 +- src/MacVim/gui_macvim.m | 5 +- 5 files changed, 71 insertions(+), 48 deletions(-) diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index 93de972bb3..1556f3651e 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -30,7 +30,7 @@ Other relevant documentation: ============================================================================== 1. MacVim differences *macvim-differences* -One of the goals of MacVim is to make Vim behave like a proper Mac OS X +One of the goals of MacVim is to make Vim behave like a proper macOS application. For this reason MacVim behaves slightly different from other GUI ports of Vim. Most of the modifications are provided in the system gvimrc file; you can quickly open this file and look at it yourself by typing: > @@ -65,8 +65,8 @@ file at all. In this situation, you will need to set both 'encoding' and the file is read into memory, the original bytes are left untouched. *macvim-shift-movement* -Text editors on Mac OS X lets the user hold down shift+movement key to extend -the selection. Also, pressing a printable key whilst selecting replaces the +Text editors on macOS lets the user hold down shift+movement key to extend the +selection. Also, pressing a printable key whilst selecting replaces the current selection with that character. MacVim can emulate this kind of behaviour (by providing key bindings and by setting 'keymodel' and 'selectmode' to non-default values) although it is not enabled by default. To @@ -121,14 +121,19 @@ These are the non-standard commands that MacVim supports: *macvim-find* Whenever you search for something in Vim (e.g. using "/") the search query is -copied to the OS X "Find Pasteboard". The idea is that if you search for +copied to the macOS "Find Pasteboard". The idea is that if you search for something and switch to another application, then you can hit (or ) to repeat the search in the new app. The same feature works if you search in some app, switch to MacVim and hit . +If you would like to turn off sharing Vim's search query to the macOS Find +Pasteboard, you can set |MMShareFindPboard| to "NO". will still use the +OS Find Pasteboard for searching though (use |n| instead if that's not what +you want). + Note that the command |n| is not the same as . The former will repeat the last search made in Vim, whereas the latter searches for the string on the -OS X Find Pasteboard using the action findNext: (see |:macaction|). +macOS Find Pasteboard using the action findNext: (see |:macaction|). The key equivalent is a great way to bring a search from one window to another in MacVim. Simply search for something in one window (using "/") then @@ -156,7 +161,7 @@ up the "Open with" menu. You can also drag and drop files onto the Dock icon to open them in tabs in a new window, or you can drop them in an already open window to open the files in tabs in that specific window (it is possible to have files open in e.g. splits by changing the "Open files from applications" -option in the General preference pane). Finally, you can use Mac OS X System +option in the General preference pane). Finally, you can use macOS System Services to open files in MacVim, see |macvim-services|. Use |mvim| script to start MacVim from Terminal. @@ -206,9 +211,9 @@ history as the window you just closed (however the next window you open will). For these reasons Quickstart is disabled by default. *odbeditor* *external-editor* -MacVim can act as an 'external editor' for Mac OS X applications that support -the ODB Editor Protocol (or the 'external editor' protocol). Each application -has different ways of configuring this option, check the application's +MacVim can act as an 'external editor' for macOS applications that support the +ODB Editor Protocol (or the 'external editor' protocol). Each application has +different ways of configuring this option, check the application's documentation. Once configured properly MacVim can be used to open files in such an application. @@ -231,32 +236,32 @@ circumstances. These options can still be changed with the "defaults" command by opening Terminal and typing > defaults write org.vim.MacVim KEY VALUE Check the man page on "defaults" for more information on this command as well -as general information regarding Mac OS X user defaults. +as general information regarding macOS user defaults. Here is a list of relevant dictionary entries: KEY VALUE ~ -MMCellWidthMultiplier width of a normal glyph in em units [float] -MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool] -MMFullScreenFadeTime fade delay for non-native fullscreen [float] -MMLoginShellArgument login shell parameter [string] -MMLoginShellCommand which shell to use to launch Vim [string] -MMNoFontSubstitution disable automatic font substitution [bool] -MMNoTitleBarWindow hide title bar [bool] -MMShareFindPboard share search text to Find Pasteboard [bool] -MMShowAddTabButton enable "add tab" button on tabline [bool] -MMTabMaxWidth maximum width of a tab [int] -MMTabMinWidth minimum width of a tab [int] -MMTabOptimumWidth default width of a tab [int] -MMTextInsetBottom text area offset in pixels [int] -MMTextInsetLeft text area offset in pixels [int] -MMTextInsetRight text area offset in pixels [int] -MMTextInsetTop text area offset in pixels [int] -MMTexturedWindow use brushed metal window (Tiger only) [bool] -MMTranslateCtrlClick interpret ctrl-click as right-click [bool] -MMUseMouseTime use mousetime to detect multiple clicks [bool] -MMVerticalSplit files open in vertical splits [bool] -MMZoomBoth zoom button maximizes both directions [bool] +*MMCellWidthMultiplier* width of a normal glyph in em units [float] +*MMDialogsTrackPwd* open/save dialogs track the Vim pwd [bool] +*MMFullScreenFadeTime* fade delay for non-native fullscreen [float] +*MMLoginShellArgument* login shell parameter [string] +*MMLoginShellCommand* which shell to use to launch Vim [string] +*MMNoFontSubstitution* disable automatic font substitution [bool] +*MMNoTitleBarWindow* hide title bar [bool] +*MMShareFindPboard* share search text to Find Pasteboard [bool] +*MMShowAddTabButton* enable "add tab" button on tabline [bool] +*MMTabMaxWidth* maximum width of a tab [int] +*MMTabMinWidth* minimum width of a tab [int] +*MMTabOptimumWidth* default width of a tab [int] +*MMTextInsetBottom* text area offset in pixels [int] +*MMTextInsetLeft* text area offset in pixels [int] +*MMTextInsetRight* text area offset in pixels [int] +*MMTextInsetTop* text area offset in pixels [int] +*MMTexturedWindow* use brushed metal window (Tiger only) [bool] +*MMTranslateCtrlClick* interpret ctrl-click as right-click [bool] +*MMUseMouseTime* use mousetime to detect multiple clicks [bool] +*MMVerticalSplit* files open in vertical splits [bool] +*MMZoomBoth* zoom button maximizes both directions [bool] As an example, if you have more than one mouse button and would wish to free up Ctrl-click so you can bind it to something else, then the appropriate @@ -337,9 +342,9 @@ highlight color when a window becomes inactive. ============================================================================== 5. Menus *macvim-menus* -Menus in Mac OS X behave slightly different from other platforms. For that +Menus in macOS behave slightly different from other platforms. For that reason two new commands have been added to Vim. To understand what these -commands do you must first understand how menus work on OS X. +commands do you must first understand how menus work on macOS. Each entry in a menu is called a "menu item". With each menu item is associated: a title, a key equivalent and an action message. When a menu is @@ -348,7 +353,7 @@ shown on the right. Key equivalents enable you to access a menu item using the keyboard instead of having to use the mouse. When a menu item is clicked it will send its associated action message. Actions can be used to instruct MacVim to paste some text (paste:), open a new window (newWindow:), etc. -Certain actions are standard throughout OS X which is why MacVim must be able +Certain actions are standard throughout macOS which is why MacVim must be able to set these for each menu item. (E.g. the menu item "Edit.Paste" must be bound to the action "paste:" otherwise pasting won't work in dialogs since that is the action that instructs them to paste something.) @@ -471,7 +476,7 @@ whose name begins with "-space" ("-flexspace") and ends with "-" Toolbar icons should be tiff, png, icns, or heic, of dimension 32x32 or 24x24 pixels. The larger size is used when 'tbis' is "medium" or "large", otherwise the smaller size is used (which is the default). If the icon file only -contains one dimension then Mac OS X will scale the icon to the appropriate +contains one dimension then macOS will scale the icon to the appropriate dimension if necessary. To avoid this, use a file format which supports multiple resolutions (such as icns) and provide both 32x32 and 24x24 versions of the icon. @@ -532,8 +537,7 @@ outline. MacVim supports two system services. These can be accessed from the MacVim submenu in the Services menu or by right-clicking a selection. For services to work, MacVim.app should be located in the /Applications folder. (You might -have to logout and then login again before Mac OS X detects the MacVim -services.) +have to logout and then login again before macOS detects the MacVim services.) These are the currently supported services: * New MacVim Buffer With Selection: Create a new buffer and paste the @@ -640,7 +644,7 @@ sometimes be slightly involved. Here are all the things you need to consider: - Bindings to are case sensitive: is not the same as . If you want to map something to Cmd+Shift+d, then you need to use , not or . -- Some command key shortcuts are reserved by Mac OS X and cannot be mapped to +- Some command key shortcuts are reserved by macOS and cannot be mapped to (e.g. ). However, some of these shortcuts can be freed up in the System Preferences under Keyboard (e.g. Cmd+Space). - A few command key mappings are set up by MacVim, see |cmd-movement|. @@ -685,9 +689,9 @@ See the section on |key-mapping| for more help on how to map keys. When editing non-English text it may be convenient to keep separate keyboard layouts for normal and insert mode. This is supported via the 'imd' option on -Mac OS X 10.5 or later (on 10.4 the 'imd' option support is not as useful as -it only switches between Roman and non-Roman input sources and it has been -known not to work very reliably). +macOS 10.5 or later (on 10.4 the 'imd' option support is not as useful as it +only switches between Roman and non-Roman input sources and it has been known +not to work very reliably). For example: When 'noimd' is enabled (i.e. IM is enabled) the input source is saved when toggling between normal and insert mode, so you can use a US layout diff --git a/runtime/doc/tags b/runtime/doc/tags index e4e30ff80b..0f60466e12 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4801,6 +4801,27 @@ Macintosh os_mac.txt /*Macintosh* Mark motion.txt /*Mark* MenuPopup autocmd.txt /*MenuPopup* MiNT os_mint.txt /*MiNT* +MMCellWidthMultiplier gui_mac.txt /*MMCellWidthMultiplier* +MMDialogsTrackPwd gui_mac.txt /*MMDialogsTrackPwd* +MMFullScreenFadeTime gui_mac.txt /*MMFullScreenFadeTime* +MMLoginShellArgument gui_mac.txt /*MMLoginShellArgument* +MMLoginShellCommand gui_mac.txt /*MMLoginShellCommand* +MMNoFontSubstitution gui_mac.txt /*MMNoFontSubstitution* +MMNoTitleBarWindow gui_mac.txt /*MMNoTitleBarWindow* +MMShareFindPboard gui_mac.txt /*MMShareFindPboard* +MMShowAddTabButton gui_mac.txt /*MMShowAddTabButton* +MMTabMaxWidth gui_mac.txt /*MMTabMaxWidth* +MMTabMinWidth gui_mac.txt /*MMTabMinWidth* +MMTabOptimumWidth gui_mac.txt /*MMTabOptimumWidth* +MMTextInsetBottom gui_mac.txt /*MMTextInsetBottom* +MMTextInsetLeft gui_mac.txt /*MMTextInsetLeft* +MMTextInsetRight gui_mac.txt /*MMTextInsetRight* +MMTextInsetTop gui_mac.txt /*MMTextInsetTop* +MMTexturedWindow gui_mac.txt /*MMTexturedWindow* +MMTranslateCtrlClick gui_mac.txt /*MMTranslateCtrlClick* +MMUseMouseTime gui_mac.txt /*MMUseMouseTime* +MMVerticalSplit gui_mac.txt /*MMVerticalSplit* +MMZoomBoth gui_mac.txt /*MMZoomBoth* Moolenaar intro.txt /*Moolenaar* MorphOS os_amiga.txt /*MorphOS* Motif gui_x11.txt /*Motif* diff --git a/runtime/menu.vim b/runtime/menu.vim index 98e9d79224..c24769c0ad 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -231,7 +231,7 @@ elseif has("gui_macvim") vnoremenu &Edit.Find.Find\.\.\. y:promptfind =FixFText() an 20.410.20 &Edit.Find.Find\ Next an 20.410.30 &Edit.Find.Find\ Previous - vmenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find y:let @/=@": + vnoremenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find y:let @/=@": else an 20.410 &Edit.&Find/ / an 20.420 &Edit.Find\ and\ Rep&lace:%s :%s/ diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index d444f112c5..dba6650e57 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -1582,10 +1582,7 @@ - (void)doFindNext:(BOOL)next if ([bestType isEqual:VimFindPboardType]) { query = [pb stringForType:VimFindPboardType]; } else { - BOOL shareFindPboard = [[NSUserDefaults standardUserDefaults] - boolForKey:MMShareFindPboardKey]; - if (shareFindPboard) - query = [pb stringForType:NSStringPboardType]; + query = [pb stringForType:NSStringPboardType]; } } diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index 3e72539dde..074c57dd0a 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -1870,6 +1870,8 @@ { if (!pat) return; + if (!MMShareFindPboard) return; + #ifdef FEAT_MBYTE pat = CONVERT_TO_UTF8(pat); #endif @@ -1891,8 +1893,7 @@ // The second entry will be used by other applications when taking entries // off the Find pasteboard, whereas MacVim will use the first if present. [pb setString:s forType:VimFindPboardType]; - if (MMShareFindPboard) - [pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType]; + [pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType]; } void From b3907e6722982dba04d9c9897a11b179a2ef1921 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Sun, 18 Nov 2018 21:04:41 -0800 Subject: [PATCH 2/2] Make Cmd-E work and always share to OS Find Pasteboard 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. --- runtime/doc/gui_mac.txt | 20 ++++++++++++-------- runtime/menu.vim | 4 ++-- src/MacVim/Actions.plist | 2 ++ src/MacVim/MMBackend.h | 4 ++++ src/MacVim/MMBackend.m | 30 ++++++++++++++++++++++++++++++ src/MacVim/MMWindowController.h | 1 + src/MacVim/MMWindowController.m | 5 +++++ src/MacVim/MacVim.h | 1 + src/MacVim/gui_macvim.m | 14 +++++++++++++- 9 files changed, 70 insertions(+), 11 deletions(-) diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index 1556f3651e..c596f67504 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -120,16 +120,18 @@ These are the non-standard commands that MacVim supports: |:macaction| |:macmenu| *macvim-find* -Whenever you search for something in Vim (e.g. using "/") the search query is -copied to the macOS "Find Pasteboard". The idea is that if you search for -something and switch to another application, then you can hit (or ) -to repeat the search in the new app. The same feature works if you search in -some app, switch to MacVim and hit . +Whenever you search for something in Vim (e.g. using "/"), or hit when +you have text selected, the search query is copied to the macOS "Find +Pasteboard". The idea is that if you search for something and switch to +another application, then you can hit (or ) to repeat the search in +the new app. The same feature works if you search in some app, switch to +MacVim and hit . If you would like to turn off sharing Vim's search query to the macOS Find -Pasteboard, you can set |MMShareFindPboard| to "NO". will still use the -OS Find Pasteboard for searching though (use |n| instead if that's not what -you want). +Pasteboard, you can set |MMShareFindPboard| to "NO". Even when that's set, + will still use the OS Find Pasteboard for searching (use |n| instead if +that's not what you want), and ("Edit -> Use Selection for Find") will +still share the search pattern to Find Pasteboard. Note that the command |n| is not the same as . The former will repeat the last search made in Vim, whereas the latter searches for the string on the @@ -445,6 +447,8 @@ Action Description ~ fileOpen: Show "File Open" dialog findNext: Search forward using the "Find Pasteboard" findPrevious: Search backward using the "Find Pasteboard" +useSelectionForFind: Search the selected text and share to "Find + Pasteboard" fontSizeDown: Decrease font size fontSizeUp: Increase font size hide: Hide MacVim diff --git a/runtime/menu.vim b/runtime/menu.vim index c24769c0ad..7a8af09eec 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -231,7 +231,7 @@ elseif has("gui_macvim") vnoremenu &Edit.Find.Find\.\.\. y:promptfind =FixFText() an 20.410.20 &Edit.Find.Find\ Next an 20.410.30 &Edit.Find.Find\ Previous - vnoremenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find y:let @/=@": + vnoremenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find else an 20.410 &Edit.&Find/ / an 20.420 &Edit.Find\ and\ Rep&lace:%s :%s/ @@ -1261,7 +1261,7 @@ if has("gui_macvim") macm Edit.Find.Find\.\.\. key= macm Edit.Find.Find\ Next key= action=findNext: macm Edit.Find.Find\ Previous key= action=findPrevious: - macm Edit.Find.Use\ Selection\ for\ Find key= + macm Edit.Find.Use\ Selection\ for\ Find key= action=useSelectionForFind: macm Edit.Font.Show\ Fonts action=orderFrontFontPanel: macm Edit.Font.Bigger key= action=fontSizeUp: macm Edit.Font.Smaller key= action=fontSizeDown: diff --git a/src/MacVim/Actions.plist b/src/MacVim/Actions.plist index a28f89a2e3..6db599bc62 100644 --- a/src/MacVim/Actions.plist +++ b/src/MacVim/Actions.plist @@ -22,6 +22,8 @@ findPrevious: + useSelectionForFind: + fontSizeDown: fontSizeUp: diff --git a/src/MacVim/MMBackend.h b/src/MacVim/MMBackend.h index bbebc7e24e..4c771a30cb 100644 --- a/src/MacVim/MMBackend.h +++ b/src/MacVim/MMBackend.h @@ -58,6 +58,7 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; BOOL imState; int winposX; int winposY; + BOOL addToFindPboardOverride; #ifdef FEAT_BEVAL NSString *lastToolTip; #endif @@ -155,6 +156,9 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; - (void)setWaitForAck:(BOOL)yn; - (void)waitForConnectionAcknowledgement; +- (BOOL)addToFindPboardOverride; +- (void)clearAddToFindPboardOverride; + - (BOOL)imState; - (void)setImState:(BOOL)activated; diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 2146fb53ee..1933f75555 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -193,6 +193,7 @@ - (int)checkForModifiedBuffers; - (void)addInput:(NSString *)input; - (void)redrawScreen; - (void)handleFindReplace:(NSDictionary *)args; +- (void)useSelectionForFind; - (void)handleMarkedText:(NSData *)data; - (void)handleGesture:(NSData *)data; #ifdef FEAT_BEVAL @@ -254,6 +255,8 @@ - (id)init ASLogNotice(@"Failed to load dictionaries.%@", MMSymlinkWarningString); } + addToFindPboardOverride = NO; + return self; } @@ -1701,6 +1704,16 @@ - (oneway void)acknowledgeConnection waitForAck = NO; } +- (BOOL)addToFindPboardOverride +{ + return addToFindPboardOverride; +} + +- (void)clearAddToFindPboardOverride +{ + addToFindPboardOverride = NO; +} + - (BOOL)imState { return imState; @@ -2072,6 +2085,8 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data [self handleOpenWithArguments:[NSDictionary dictionaryWithData:data]]; } else if (FindReplaceMsgID == msgid) { [self handleFindReplace:[NSDictionary dictionaryWithData:data]]; + } else if (UseSelectionForFindMsgID == msgid) { + [self useSelectionForFind]; } else if (ZoomMsgID == msgid) { if (!data) return; const void *bytes = [data bytes]; @@ -2967,6 +2982,21 @@ - (void)handleFindReplace:(NSDictionary *)args vim_free(replace); } +- (void)useSelectionForFind +{ + if (VIsual_active && (State & NORMAL)) { + // This happens when Cmd-E is pressed and is supposed to be consistent + // with normal macOS apps, so it always writes to the system find + // pasteboard, unlike normal searches where it could be turned off via + // MMShareFindPboard. Set an override to make sure it gets shared out. + // Since gui_macvim_add_to_find_pboard is going to get called after + // this returns it will be responsible for calling + // clearAddToFindPboardOverride to clean up. + addToFindPboardOverride = YES; + [self addInput:@"y:let @/=@\":"]; + } +} + - (void)handleMarkedText:(NSData *)data { diff --git a/src/MacVim/MMWindowController.h b/src/MacVim/MMWindowController.h index 5e97478f9a..7256fef830 100644 --- a/src/MacVim/MMWindowController.h +++ b/src/MacVim/MMWindowController.h @@ -102,6 +102,7 @@ - (IBAction)performClose:(id)sender; - (IBAction)findNext:(id)sender; - (IBAction)findPrevious:(id)sender; +- (IBAction)useSelectionForFind:(id)sender; - (IBAction)vimMenuItemAction:(id)sender; - (IBAction)vimToolbarItemAction:(id)sender; - (IBAction)fontSizeUp:(id)sender; diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index dba6650e57..5fa8ab47a7 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -877,6 +877,11 @@ - (IBAction)findPrevious:(id)sender [self doFindNext:NO]; } +- (IBAction)useSelectionForFind:(id)sender +{ + [vimController sendMessage:UseSelectionForFindMsgID data:nil]; +} + - (IBAction)vimMenuItemAction:(id)sender { if (![sender isKindOfClass:[NSMenuItem class]]) return; diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 9ad5238d04..60a9bef310 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -234,6 +234,7 @@ enum { SetFullScreenColorMsgID, ShowFindReplaceDialogMsgID, FindReplaceMsgID, + UseSelectionForFindMsgID, ActivateKeyScriptMsgID, DeactivateKeyScriptMsgID, EnableImControlMsgID, diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index 074c57dd0a..da98ec4888 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -1870,7 +1870,19 @@ { if (!pat) return; - if (!MMShareFindPboard) return; + if ([MMBackend sharedInstance].addToFindPboardOverride) { + // MMBackend would set addToFindPboardOverride to YES when we are + // using the useSelectionFodFind: macaction, accessible via Cmd-E, + // which indicates we always want to share to the find pasteboard + // unlike normal search. Since this function is called after the action + // is handled we need to manually clear the override so it doesn't + // persist in later searches. + [[MMBackend sharedInstance] clearAddToFindPboardOverride]; + } else { + if (!MMShareFindPboard) { + return; + } + } #ifdef FEAT_MBYTE pat = CONVERT_TO_UTF8(pat);