Skip to content

Commit af6bd98

Browse files
authored
Merge pull request #789 from ychin/fix_tabs_dragging
Fix dragging tabs not working properly
2 parents e5d1176 + 7e1b43e commit af6bd98

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/MacVim/MMBackend.m

+8
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,14 @@ - (void)handleInputEvent:(int)msgid data:(NSData *)data
20132013
// based.
20142014
int idx = *((int*)bytes);
20152015

2016+
// Also, this index doesn't take itself into account, so if the move is
2017+
// to a later tab, need to add one to it since Vim's tabpage_move *does*
2018+
// count the current tab.
2019+
int curtab_index = tabpage_index(curtab);
2020+
if (idx >= curtab_index) {
2021+
idx += 1;
2022+
}
2023+
20162024
tabpage_move(idx);
20172025
} else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid
20182026
|| SetTextDimensionsNoResizeWindowMsgID == msgid

src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m

+4-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,10 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame
338338
if(([self state] == NSOnState) && ([[_controlView styleName] isEqualToString:@"Metal"]))
339339
cellFrame.size.width += 1.0;
340340
[_controlView lockFocus];
341-
NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:cellFrame] autorelease];
341+
342+
NSBitmapImageRep *rep = [[self controlView] bitmapImageRepForCachingDisplayInRect:cellFrame];
343+
[[self controlView] cacheDisplayInRect:cellFrame toBitmapImageRep:rep];
344+
342345
[_controlView unlockFocus];
343346
NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
344347
[image addRepresentation:rep];

0 commit comments

Comments
 (0)