Skip to content

Commit

Permalink
While searching for a view to move up/down/left/right to, adjust for …
Browse files Browse the repository at this point in the history
…splitters.

Before, if going in the indicated direction from the caret
resulted in coordinates that were on a split view splitter, we
would simply fall back on the old behavior of going to the first
entry in the split in the given direction. We now adjust the
coordinates either rightwards or downwards (depending on
whether we’re looking for the next text view vertically or
horizontally) so as to move off of the splitter.
  • Loading branch information
Shadowfiend committed Dec 7, 2013
1 parent 9c02825 commit ac1c9a0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/ViWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#import "ViLayoutManager.h"
#import "ExTextField.h"
#import "ViEventManager.h"
#import "ViRulerView.h"
#import "NSURL-additions.h"
#import "ExCommand.h"
#import "ViError.h"
Expand Down Expand Up @@ -1933,6 +1934,20 @@ - (BOOL)selectViewAtPosition:(ViViewOrderingMode)position relativeTo:(ViViewCont
fromView:scrollView];

hitView = [tabController.view hitTest:splitViewReferencePoint];

// If we landed on a split view, that means we're moving along a split
// view divider. We add some jitter in the appropriate direction to shift
// off of that divider.
//
// Additionally, if we're moving up or down and hit one of the ruler view
// classes, we push the reference point's x coordinate right so that we end
// up off of the ruler view and on the text view.
if ([hitView isKindOfClass:[NSSplitView class]]) {
if (position == ViViewUp || position == ViViewDown) {
referencePoint.x += 10;
} else if (position == ViViewLeft || position == ViViewRight) {
referencePoint.y += 10;
}
} while (hitView && ! [hitView isKindOfClass:[ViTextView class]]);
}

Expand Down

0 comments on commit ac1c9a0

Please sign in to comment.