Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 62 lines (52 sloc) 1.65 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
//
// XVimMotionArgumentEvaluator.m
// XVim
//
// Created by Tomas Lundell on 1/04/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "XVimMotionArgumentEvaluator.h"
#import "XVimKeyStroke.h"
#import "XVimMotionEvaluator.h"

// This evaluator is base class of an evaluator which takes argument to fix the motion
// e.g. 'f','F'
@implementation XVimMotionArgumentEvaluator

- (id)initWithContext:(XVimEvaluatorContext*)context
parent:(XVimMotionEvaluator*)parent
{
if (self = [super initWithContext:context parent:parent])
{
}
return self;
}

- (XVimMotionEvaluator*)motionEvaluator
{
return (XVimMotionEvaluator*)_parent;
}

-(XVimEvaluator*)_motionFixedFrom:(NSUInteger)from To:(NSUInteger)to Type:(MOTION_TYPE)type inWindow:(XVimWindow*)window
{
    if( nil != _parent ){
        return [[self motionEvaluator] motionFixedFrom:from To:to Type:type inWindow:window];
    }
    return nil;
}

- (XVimEvaluator*)commonMotion:(SEL)motion Type:(MOTION_TYPE)type inWindow:(XVimWindow*)window
{
    if( nil != _parent ){
        return [[self motionEvaluator] commonMotion:motion Type:type inWindow:window];
    }
    return nil;
}

- (XVimRegisterOperation)shouldRecordEvent:(XVimKeyStroke*) keyStroke inRegister:(XVimRegister*)xregister
{
    if (xregister.isRepeat){
        if (xregister.nonNumericKeyCount == 1){
            if([keyStroke classResponds:[XVimMotionArgumentEvaluator class]] || keyStroke.isNumeric){
                return REGISTER_APPEND;
            }
        }
        
        return REGISTER_IGNORE;
    }
    
    return [super shouldRecordEvent:keyStroke inRegister:xregister];
}

@end
Something went wrong with that request. Please try again.