Skip to content

Commit

Permalink
Fix smart selection pointer command to also copy to pasteboard
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Jan 17, 2012
1 parent d8c30e7 commit f38cd7f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 17 additions & 0 deletions PTYTextView.m
Expand Up @@ -3371,6 +3371,23 @@ - (void)smartSelectIgnoringNewlinesWithEvent:(NSEvent *)event
[self smartSelectAtX:x y:y ignoringNewlines:YES];
}

- (void)smartSelectAndMaybeCopyWithEvent:(NSEvent *)event
ignoringNewlines:(BOOL)ignoringNewlines
{
NSPoint clickPoint = [self clickPoint:event];
int x = clickPoint.x;
int y = clickPoint.y;

[self smartSelectAtX:x y:y ignoringNewlines:ignoringNewlines];
[self setSelectionTime];
if (startX > -1 && _delegate) {
// if we want to copy our selection, do so
if ([[PreferencePanel sharedInstance] copySelection]) {
[self copy:self];
}
}
}

- (void)openContextMenuWithEvent:(NSEvent *)event
{
NSPoint clickPoint = [self clickPoint:event];
Expand Down
4 changes: 2 additions & 2 deletions PointerController.h
Expand Up @@ -14,8 +14,8 @@
- (void)pasteFromSelectionWithEvent:(NSEvent *)event;
- (void)openTargetWithEvent:(NSEvent *)event;
- (void)openTargetInBackgroundWithEvent:(NSEvent *)event;
- (void)smartSelectWithEvent:(NSEvent *)event;
- (void)smartSelectIgnoringNewlinesWithEvent:(NSEvent *)event;
- (void)smartSelectAndMaybeCopyWithEvent:(NSEvent *)event
ignoringNewlines:(BOOL)ignoringNewlines;
- (void)openContextMenuWithEvent:(NSEvent *)event;
- (void)nextTabWithEvent:(NSEvent *)event;
- (void)previousTabWithEvent:(NSEvent *)event;
Expand Down
6 changes: 4 additions & 2 deletions PointerController.m
Expand Up @@ -25,9 +25,11 @@ - (void)performAction:(NSString *)action
} else if ([action isEqualToString:kOpenTargetPointerAction]) {
[delegate_ openTargetWithEvent:event];
} else if ([action isEqualToString:kSmartSelectionPointerAction]) {
[delegate_ smartSelectWithEvent:event];
[delegate_ smartSelectAndMaybeCopyWithEvent:event
ignoringNewlines:NO];
} else if ([action isEqualToString:kSmartSelectionIgnoringNewlinesPointerAction]) {
[delegate_ smartSelectIgnoringNewlinesWithEvent:event];
[delegate_ smartSelectAndMaybeCopyWithEvent:event
ignoringNewlines:YES];
} else if ([action isEqualToString:kContextMenuPointerAction]) {
[delegate_ openContextMenuWithEvent:event];
} else if ([action isEqualToString:kNextTabPointerAction]) {
Expand Down

0 comments on commit f38cd7f

Please sign in to comment.