Ignore caret’s “desired X” in positionForWindowUnderCaret:

For example if at column 60 on a line and moving up/down to a shorter line, we remember that column 60 is our desired column position. This would previously be used when returning a position for the caret, e.g. used with clipboard history pop-ups and bundle item disambiguation menus.
This commit is contained in:
Allan Odgaard
2014-02-19 15:41:18 +07:00
parent b1ec5cf4c2
commit 8c9ebc46ea

View File

@@ -2023,8 +2023,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
- (NSPoint)positionForWindowUnderCaret
{
CGRect r1 = layout->rect_at_index(editor->ranges().last().first);
CGRect r2 = layout->rect_at_index(editor->ranges().last().last);
CGRect r1 = layout->rect_at_index(editor->ranges().last().normalized().first);
CGRect r2 = layout->rect_at_index(editor->ranges().last().normalized().last);
CGRect r = r1.origin.y == r2.origin.y && r1.origin.x < r2.origin.x ? r1 : r2;
NSPoint p = NSMakePoint(CGRectGetMinX(r), CGRectGetMaxY(r)+4);
if(NSPointInRect(p, [self visibleRect]))