source: trunk/Cocoa/Pester/Source/PSDateFieldEditor.m @ 622

Last change on this file since 622 was 622, checked in by Nicholas Riley, 9 years ago

Fix up date completion with field editor.

Still to do:

  • autocomplete still doesn't trigger in some cases when it should
  • move things into PSTimeDateEditor so they're usable in "until..."
File size: 788 bytes
Line 
1//
2//  PSDateFieldEditor.m
3//  Pester
4//
5//  Created by Nicholas Riley on 3/1/10.
6//  Copyright 2010 Nicholas Riley. All rights reserved.
7//
8
9#import "PSDateFieldEditor.h"
10
11
12@implementation PSDateFieldEditor
13
14- (NSRange)rangeForUserCompletion;
15{
16    NSRange range = [super rangeForUserCompletion];
17    range.length += range.location;
18    range.location = 0;
19   
20    return range;
21}
22
23- (void)insertCompletion:(NSString *)word forPartialWordRange:(NSRange)charRange movement:(int)movement isFinal:(BOOL)flag;
24{
25    // space bar (or right arrow, which is less ideal)
26    if (movement == NSRightTextMovement)
27        flag = NO;
28       
29    [super insertCompletion:word forPartialWordRange:charRange movement:movement isFinal:flag];
30
31    if (movement == NSTabTextMovement)
32        [self insertTab: nil];
33}
34
35@end
Note: See TracBrowser for help on using the repository browser.