Open GoogleCodeExporter opened 9 years ago
Just realized this fix affects rangeForWordAtPoint: in the same class, which
ends up with a row 1 too low. Looking into it now.
Original comment by ryan.ch...@gmail.com
on 2 May 2011 at 2:57
OK, there was an inconsistency between the points that convertIndexFromPoint
was being called with. This fix works, as far as I can tell, for all use cases
in both normal and fullscreen mode, even when fullscreen is not scaled to fit
vertically. :)
Sorry if my solutions are not ideal; I'm new to Cocoa programming.
Index: WLTerminalView.m
===================================================================
--- WLTerminalView.m (revision 832)
+++ WLTerminalView.m (working copy)
@@ -92,10 +92,6 @@
#pragma mark Conversion
- (int)convertIndexFromPoint:(NSPoint)p {
- // The following 2 lines: for full screen mode
- NSRect frame = [self frame];
- p.y -= 2 * frame.origin.y;
-
if (p.x >= _maxColumn * _fontWidth) p.x = _maxColumn * _fontWidth - 0.001;
if (p.y >= _maxRow * _fontHeight) p.y = _maxRow * _fontHeight - 0.001;
if (p.x < 0) p.x = 0;
@@ -509,7 +505,8 @@
// Disable the mouse if we cancelled any selection
if(abs(_selectionLength) > 0)
_isNotCancelingSelection = NO;
- NSPoint p = [self convertPoint:[theEvent locationInWindow] toView:nil];
+ NSPoint p = [NSEvent mouseLocation];
+ p = [self convertPoint:[[self window] convertScreenToBase:p] fromView:nil];
_selectionLocation = [self convertIndexFromPoint:p];
_selectionLength = 0;
@@ -531,8 +528,8 @@
return;
}
- NSPoint p = [theEvent locationInWindow];
- p = [self convertPoint:p toView:nil];
+ NSPoint p = [NSEvent mouseLocation];
+ p = [self convertPoint:[[self window] convertScreenToBase:p] fromView:nil];
int index = [self convertIndexFromPoint:p];
int oldValue = _selectionLength;
_selectionLength = index - _selectionLocation + 1;
Original comment by ryan.ch...@gmail.com
on 2 May 2011 at 5:24
Original issue reported on code.google.com by
ryan.ch...@gmail.com
on 2 May 2011 at 2:03